ASP.NET SqlMembership Provider allow multiple users with same name
I have a web application that is kind of a hub for different companies. Each one of these companies will be allowed to manage (create/delete) its own user.
If there are thousands of companies using the application, they're bound to create users with the same Username as other companies. Now, currently 'company a' cannot have the same username as 'comp开发者_如何学JAVAany b' even though neither company knows the other even exists.
Is it possible with SqlMembershipProvider to allow for multiple usernames based on an application specific criteria (in the example above it would be the company name or company id)? And if so, is there an example available online on how I can accomplish this?
Any help would be appreciated. Thanks!
Two thoughts:
- Require username to be an email address; you're guranteed uniqueness even across companies.
- Set the MembershipProvider's
ApplicationName
base on the company; you can do this onSessionStart
or some other such event.
I believe this works if you use the other "username" parameter -- the application name. Set each company up with their own application name for users and you should be able to make usernames unique within each company.
精彩评论