Shaz
Shaz

Reputation: 2704

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 'company 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!

Upvotes: 2

Views: 990

Answers (2)

Esteban Araya
Esteban Araya

Reputation: 29664

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.

Upvotes: 1

Wyatt Barnett
Wyatt Barnett

Reputation: 15673

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.

Upvotes: 1

Related Questions