0

I have an ASP.NET Website in which I am facing login issue with user name being added as multiple but with different Application ID, but user names are same.

Since for this application many developers had been working on it, and whoever started it, he created a new Appliction Name in the Web.config as well as in the ASPNET Membership configuration(aspnet_regsql.exe, etc.), and some Appliction Names were given for Testing
builds/testing purposes only.

Due to the above mentioned reason, various similar named users have been added to the database, but their application id are different. And due to this, the login is causing some failure, and the users are unable to login.

Although I have found one of the following article useful, I think it might give some hint for the people who are trying to answer my question:-

How do I prevent duplicate membership users when using multiple roleproviders with different application names?

In the Server where the application has been deployed, the Error Log in the Applications are showing the following detail:- Event code: 4006 Event message: Membership credential verification failed.

Since the Application Name is to be just one, i.e. "/FOPortal", rest are not to be used.

Kindly find below the web.config sections which may be needed:-

<add name="utConnString" connectionString="Data Source=blabla\SQLEXPRESS2008;Initial Catalog=FOPortal;User Id=sa;Password=123;Max Pool Size=100;" providerName="System.Data.SqlClient"/>
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="20">
<providers>
 <clear/>
<add name="SqlProvider" type="System.Web.Security.SqlMembershipProvider"         connectionStringName="utConnString" enablePasswordRetrieval="false"  enablePasswordReset="true" requiresQuestionAndAnswer="false" passwordFormat="Hashed"  applicationName="/FOPortal"/>
</providers>
</membership>
<roleManager enabled="true"></roleManager>

I would like to know that how would I resolve this issue.

Sincerely,
Muzaffar Ali Rana.

Community
  • 1
  • 1
Muzaffar Ali Rana
  • 487
  • 4
  • 11
  • 22
  • You need to first figure out how to fix the membership data. After you do that you can worry about solving the code. You have not given enough information to help with either issue. – Security Hound Sep 07 '12 at 15:23
  • What else information is needed ? And how do I need to fix the Membership Data, any suggestion ? – Muzaffar Ali Rana Sep 07 '12 at 15:32

1 Answers1

1

I would do an update based on distinctly selected user names and update the applicationid for the fields whose user names you would like to remain valid in the current state of the application.

Sharepoint Setup Thread

Michael Schmidt
  • 9,090
  • 13
  • 56
  • 80
wes
  • 265
  • 1
  • 11
  • Thanks @wes! Well I ran the sql script mentioned in the above link, but it is causing the following error:- Cannot insert duplicate key row in object 'dbo.aspnet_Users' with unique index 'aspnet_Users_Index'. The statement has been terminated. Since there already exists the ApplicationID in the similar named user, but with application name different. Can anyone help me how to resolve this? – Muzaffar Ali Rana Sep 10 '12 at 11:50
  • @MuzaffarAliRana, you need to do an update rather than an insert. Find a user with the correct applicationID and update the users you want to retain to use that applicationID in the appropriate tables (membership, users, etc). If the member already has the appropriate applicationID, you do not need to update them – wes Sep 10 '12 at 13:13
  • Yes I used the UPDATE command, but it was giving the error mentioned above. Plz find below the commands:- DECLARE @NewApplicationId uniqueidentifier SET @NewApplicationId='B677EFE3-58F5-49C3-99E8-730D21B6BE7C' UPDATE [FOPortal120724].[dbo].aspnet_Users SET ApplicationId=@NewApplicationId UPDATE [FOPortal120724].[dbo].aspnet_Membership SET ApplicationId=@NewApplicationId UPDATE [FOPortal120724].[dbo].aspnet_Paths SET ApplicationId=@NewApplicationId UPDATE [FOPortal120724].[dbo].aspnet_Roles SET ApplicationId=@NewApplicationId – Muzaffar Ali Rana Sep 10 '12 at 14:08
  • Please help me, I am stuck in this issue, it is creating a bottle-neck for me. – Muzaffar Ali Rana Sep 14 '12 at 14:36