开发者

ASP.NET SqlMembership Provider allow multiple users with same name

开发者 https://www.devze.com 2023-03-05 18:47 出处:网络
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.

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:

  1. Require username to be an email address; you're guranteed uniqueness even across companies.
  2. Set the MembershipProvider's ApplicationName base on the company; you can do this on SessionStart 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.

0

精彩评论

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