Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey guys, I setup the standard ASP .NET membership provider in an application. However, the issue referenced in the question above has happened a few times. I'm not sure why it continues to happen. It happens upon first load of the application as I'm using the function that grabs all users and returns the count property. As far as I know, it should not be allowing duplicate membership records. When I try to purposefully duplicate my account in the application, I can't reproduce the issue. What troubleshooting steps or solutions should I be looking for to prevent this from happening?

Item has already been added Key in dictionary: ‘Brian Tester' Keybeing added: ‘Brian Tester'
Posted
Updated 7-Jan-14 2:49am
v4
Comments
When it loads for the first time, some page must be loading. So, put a debugger on the Page Load and try to see where exactly is the issue by going line by line.
kenexcelon 7-Jan-14 10:19am    
Hi Tadit, thanks for your reply. We are showing a count and it's occuring from a call like this:

Membership.GetAllUsers().Count;

There are duplicae records in the aspnet users table, however, there shouldn't be duplicates in the first place. The 2nd reocrd was created .9 seconds after the first as best as I can tell.
So, for that duplicate record, you are getting the exception?
Is there anything else creating problem?

And on that particular code line...

Membership.GetAllUsers().Count;

Exception is thrown or any other line?
kenexcelon 9-Jan-14 8:52am    
The exception is indeed thrown on that line. The duplicate record is the cause, but no exception is thrown otherwise after deleting the duplicate account. My issue is, how and why is it duplicating in the database to begin with? When I try to re-register my account, I get a message stating I cannot.

Thanks :)
I guess something is wrong. It should not duplicate. Can you post the code snippets?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900