Home » Asp.net

PasswordRecovery control and multiple websites

Can anyone point me to a reference, or sample code, on how to use the passwordrecovery control with multiple websites?

I'm working on a web application which 'contains' two related websites.  Each website has its own set of users.  Currently the password recovery logic works for only one website.  If a user tries to retrieve their password for the other website they receive a message indicating unable to retrieve their password.



4 Answers Found


Answer 1

Are you trying to recover password  of users  on website2 on website  1? If that is the case then i think it may not be possible? Why you are not allowing users to rest passowrds on respective sites? 


Answer 2

i think you can create two membership provider both connecting to different database

Now once this is done, you can use Membership.Providers[providerName].Validate() and other methods to validate users  against the database.

Hope above helps.



Answer 3

The web.config file does have two membership provider entries, one for each website.  The data for each website  is stored in its own database, however, the two websites  do share a 'user' database (ie - all usernames and passwords for both sites are stored in the 'user' database).

In the <membership> tag the default provider specified is for the 1st website.  The aspx page for recovering the password  has a field to enter your username and two radiobuttons to select which website you are retrieving the password for.  When the default provider in the membership tag is set  to the 1st website and a user  tries to retrieve  their password from the 2nd website the user gets the message  'unable to access your information'.

If I change the default provider to use the 2nd website and a user tries to retrieve their password from the 1st website, the username is accepted however on the page where the user enters the answer to their security question the user receives the message 'your answer could not be verified'.  If the user tries to retrieve their password from the 2nd website it appears to work correctly and the user gets the message 'your password has been sent to you' however the email is never received.

I'm not quite sure where/how to troubleshoot from this point


Answer 4

I added a logic  in the code  behind for the RecoverPassword.aspx page to retrieve  the membershipProvider and set  the value of the membershipProvider for the PasswordRecovery control  when the control is loaded.  This seems to have resolved the issue of not being able to reset a password  for the 2nd website.

However I'm running into an issue now where the email containing the new password is never received.  This only happens if recovering the password for the 2nd website, the password recovery  and email work fine for the 1st website.

I do know the password is being changed for the 2nd website  as I can access an admin page in the 1st website which shows the username and passwords for all users  from both websites.

Any ideas on how to track down why the email isn't being received if recovering the password from the 2nd website? 




<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure