?
Solved

Roles.AddUserToRole gives an error " The user 'newUser' is already in role 'Guests' "

Posted on 2007-10-15
3
Medium Priority
?
920 Views
Last Modified: 2012-05-05
When using a standard login control it won't allow me to add a new user, not even "JoeBloggs".
The following is the code:
Roles.AddUserToRole(username, "Guests")

The following is the error:
An exception of type 'System.Configuration.Provider.ProviderException' occurred in System.Web.dll but was not handled in user code
Additional information: The user 'JoeBloggs' is already in role 'Guests'.
0
Comment
Question by:Netlink2
3 Comments
 
LVL 22

Assisted Solution

by:RedKelvin
RedKelvin earned 800 total points
ID: 20083511
0
 
LVL 18

Accepted Solution

by:
Ajay Sharma earned 1200 total points
ID: 20083519
0
 
LVL 1

Author Comment

by:Netlink2
ID: 20098319
What I did to fix the problem was to delete the login database, recreate it with aspnet_regsql.exe. Then I redid the actual login page from scratch.

I also had to change the web.config file to
  <remove name="LocalSqlServer"/>
  <add name="LocalSqlServer" connectionString="Data Source=Server;Initial Catalog=RealEstate;Persist Security Info=True;User ID=myId;pwd=myPW"/>

I still don't know exactly where the problem was, but removing the connectionstring caused the error to change.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month17 days, 6 hours left to enroll

862 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