views:

37

answers:

1

Hi there,

can anyone help?

I recently had asp.net membership setup using a connection string to my db via the web.config in my service layer. It enabled me to do something like this :-

    public bool IsValidLogin(string username, string password)
    {
        return System.Web.Security.Membership.ValidateUser(username, password);
    }

As you can see i am using methods on the system.web.security.membership namesspace and it works as it should :-)

I have now moved my database onto a WCF Data Service, again this is working well for various tables i have...

But i do i get the membership to point to the wcf data service, i can't edit the connection string to point to the data service can I?

hence i could still do

  return System.Web.Security.Membership.ValidateUser(username, password);

and it would contact the tables/db via wcf data service and not a physical connection string.

It seems pretty silly to still have a connection string in my service layer ... when all my data access is done via my dataaccess layer (wcf data service)

Any ideas really appreciated

I am stuck ..

A: 

Just wrap the membership call and expose it as a WCF service. Easy, then all of your applications can just call the service's "ValidateUser" method, and the underlying code running in the service would defer to the membership API

Joel Martinez
thanks Joel, but then i would still need a connection string to my DB? but this is just wrapping each method, the service would still need the stuff in the webconfig for memberhship and a valid connection string - no?
mark smith
Yes of course you would need a connection string ... after all, the membership APIs would still use it (assuming you're using the correct provider) ... just put it in the .config of the service
Joel Martinez