开发者

ASP.NET Membership Provider : set Application Name dynamically

开发者 https://www.devze.com 2023-03-22 22:52 出处:网络
I\'m creating a WCF service to share all membership operations(such as user creation, login, change password, etc) between multiple applications (websites, WS, IPhone App, etc), using the ASP.NET Memb

I'm creating a WCF service to share all membership operations (such as user creation, login, change password, etc) between multiple applications (websites, WS, IPhone App, etc), using the ASP.NET Membership Provider.

I want also to store information about app开发者_运维知识库lication sending the request.

I'm wondering if it make sense to dynamically set the Membershio provider's Application Name so to store this info in the membership tables? Since the provider is a singleton it would be something like :

System.Web.Security.Membership.ApplicationName = application;
bool isValid = System.Web.Security.Membership.ValidateUser(username, password);

It actually works but don't know if this is a proper use and if it can cause any trouble in future. Usually as far as I know the application name comes from the Web.config (but in my scenario it would be always the same, the WCF one) and I haven't seen any example where this Property is dynamically set.

Another option would be to store this info in a separate table and leave the Application Name static coming from web.config.

Any suggestion is welcome!


That's not what the application name is for in the membership providers.

You say that you want the user accounts to be shared between multiple applications. In this case the membership application name must be the same between all applications.

The app name is there to allow multiple applications to share the same database but keep their users isolated - a web site configured with an application of app1 will not share users with an application of app2 even if they share the same physical membership database.

Log it elsewhere!

0

精彩评论

暂无评论...
验证码 换一张
取 消