Solved

asp.net users with same username

Posted on 2010-08-24
9
276 Views
Last Modified: 2012-05-10
Hi,
I am writing an application that allows multiple companies to use the application, I was planning on using the Applications table to hold the company names and so allow for example, two seperate companies to have users with the same user name, this would also allow me to use the multiple built in membership classes. But I just found this on the microsoft site, so I am presuming this is not a good idea. Is there an alternative to this?

Caution
Because a single default membership provider instance is used for all of the requests served by an HttpApplication object, you can have multiple requests executing concurrently and attempting to set the ApplicationName property value. The ApplicationName property is not thread safe for multiple writes, and changing the ApplicationName property value can result in unexpected behavior for multiple users of an application. We recommend that you avoid writing code that allows users to set the ApplicationName property, unless you must. An example of an application where setting the ApplicationName property may be required is an administrative application that manages membership data for multiple applications. Such an application should be a single-user application and not a Web application.
 
0
Comment
Question by:Soluga
  • 6
  • 2
9 Comments
 
LVL 7

Expert Comment

by:alphaau
ID: 33509276
is it good to hold different company data in a single db?
or you can maintain multiple instance of your server to hold different company data?
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 33509284
I don't really think that should affect you. It is simply warning about changing an Applications name, rather than simply using multiple applications. Changing the name isn't really something you should need to do in this scenario.
0
 
LVL 1

Author Comment

by:Soluga
ID: 33509358
So I need to be able to set the application name property for the membershipProvider, the roleProvider and the profileProvider when a user logs in. Is there a way of doing this?
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 33509386
How are you planning on determining which company is accessing the site? Are you using two seperate entry points with a shared code base?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:Soluga
ID: 33509426
I have a seperate company details table that holds a general company ID number, when a user logs in, they have to enter the company id number, their username and password. A class then returns the applicationID which if correct can be used to authenticate the users in the membership table.
0
 
LVL 1

Author Comment

by:Soluga
ID: 33509446
So if the users in authenticated, I need to be able to set the application name property for the membershipProvider, the roleProvider and the profileProvider
0
 
LVL 1

Author Comment

by:Soluga
ID: 33509658
I can use.....
 Membership.ApplicationName = "test" but that is all so far!
0
 
LVL 1

Author Comment

by:Soluga
ID: 33510281
Getting closer....

Dim roleprovider As RoleProvider = New SqlRoleProvider
 Dim profileProvider As ProfileProvider = New SqlProfileProvider
 Dim memberProvider As MembershipProvider = New SqlMembershipProvider

roleprovider.ApplicationName = "test"

profileProvider.ApplicationName = "test"


memberProvider.ApplicationName = "test"
0
 
LVL 1

Accepted Solution

by:
Soluga earned 0 total points
ID: 33510507
It appears I will have to create a provider for each section to reflect the company in the web config like so...

http://www.dotnetmonster.com/Uwe/Forum.aspx/asp-net-security/3911/Membership-ApplicationName-and-thread-safety 
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now