Get user email

S

shapper

Hello,

I am using Asp.Net 2.0 Membership.
How can I check if a username exists and if it does, get its email
address.
Then I need to reset its password.

I am creating my own custom method to reset the user password and send
it though email.

Thanks,
Miguel
 
M

Mark Fitzpatrick

Take a look at the System.Web.Security.Membership class, there's a static
method therre that returns an array of users on a given email. The method
is: FindUsersByEmail.

If you find the user, you can then use the resetpassword method to change
the password. This will generate a new password, but use the membership
api's idea of a password. If you want to use your own you can call reset
password and save the new password into a string. You can then use the
membershipuser's changepassword and pass the string containing the reset
password value (because that's now technically the old value) and pass in
the new password that you would like based upon whatever algorithm you would
use.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top