473,324 Members | 2,246 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

2 Password Recovery questions!

hi

asp.net 2.0

#1
How do I in the OnSendingMail method get the user email address so I knows
where to send the email?

#2
What is the code I need to use in the bodyfile for specifying where the
password should be placed in the email?

Best Regards!
Oct 8 '08 #1
5 1894
#1
First, make sure you need to send the email before circumventing the
automagic stuff. If so you can use the sendingEmail to circumvent.

Make sure you include this:

e.Cancel = True

If not, you will send both yours and the one from the control. Here is a
routine I set up for test purposes (VB - normally I am C#, but it should be
easy enough to translate, if that is your desire):

Private Sub SendVerificationEmail(ByRef userName As String, ByVal
password As String, ByVal email As String)

Dim path As String = "~/emails/resetPassword.txt"
Dim reader As New StreamReader(Server.MapPath(path))
Dim fromAddress As String =
ConfigurationManager.AppSettings("ForgottenPasswor dEmailAddress")
Dim toAddress As String = email
Dim subject As String = "Your Logon Information"
Dim message As String = reader.ReadToEnd()

'Yeah this sucks, but it is doing wrong otherwise
message = message.Replace("{userName}", userName)
message = message.Replace("{loginName}", userName)
message = message.Replace("{password}", password)

Dim msg As New MailMessage(fromAddress, toAddress, subject, message)

Dim smtp As New SmtpClient()
smtp.DeliveryMethod = SmtpDeliveryMethod.Network
smtp.Send(msg)

End Sub

The text in password.txt is:

Dear {userName},
Your MySite.com user name and password are :

Login Name : {loginName}
Generated Password : {password}

For security purposes, you should log in and reset your password as soon as
possible. Please log in using the above password and go to the Personal Menu
and click MyPassword. Use the above password for the old password and choose
a new password.
Thank you for using MySite.com.

You can alter this however you please.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:eU**************@TK2MSFTNGP03.phx.gbl...
hi

asp.net 2.0

#1
How do I in the OnSendingMail method get the user email address so I knows
where to send the email?

#2
What is the code I need to use in the bodyfile for specifying where the
password should be placed in the email?

Best Regards!
Oct 8 '08 #2
Thanks for that tip. On a second thought I think I will not send email when
password is being changed. However I'm thankful for that information you
gave me, because I will use it for creating email for password recovery
etc...

Yes I prefer c#

but to another problem:
When I click on the button in passwordrecovery nothing happens, below is the
markup of my passwordrecovery.
<asp:ChangePassword ID="ChangePassword1" runat="server">
<ChangePasswordTemplate>
<table style="background-color:#bbccee;">
<tr>
<td align="right">Nåværende Passord:</td>
<td><asp:TextBox ID="CurrentPassword" TextMode="Password"
runat="server"></asp:TextBox></td>
<td>
<asp:RequiredFieldValidator ID="valRequireUsername"
SetFocusOnError="true"
Display="Dynamic"
ControlToValidate="CurrentPassword" runat="server"
ErrorMessage="Nåværende passord er nødvendig"
ValidationGroup="ChangePassword1" >*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">Nytt Passord:</td>
<td><asp:TextBox ID="NewPassword" TextMode="Password"
runat="server"></asp:TextBox></td>
<td></td>
</tr>
<tr>
<td align="right">Bekreft Passord:</td>
<td><asp:TextBox ID="ConfirmPassword" TextMode="Password"
runat="server"></asp:TextBox></td>
<td></td>
</tr>
<tr>
<td colspan="3">
<asp:Label ID="FailureText" EnableViewState="false"
runat="server" ></asp:Label>
<asp:ImageButton ID="ChangePassword"
CommandName="Submit" ImageUrl="~/Images/Go.gif" runat="server" />
</td>

</tr>
</table>
</ChangePasswordTemplate>
</asp:ChangePassword>

any suggestions?
Oct 9 '08 #3
Opps, that isn't passwordrecovery, but changepassword instead. I refer to
the last section in my previous post where I mention I have trouble with my
changepasword control...
Oct 9 '08 #4
It was not a spot on example, but I am glad if it helps. ;-)

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:OQ**************@TK2MSFTNGP04.phx.gbl...
Thanks for that tip. On a second thought I think I will not send email
when password is being changed. However I'm thankful for that information
you gave me, because I will use it for creating email for password
recovery etc...

Yes I prefer c#

but to another problem:
When I click on the button in passwordrecovery nothing happens, below is
the markup of my passwordrecovery.
<asp:ChangePassword ID="ChangePassword1" runat="server">
<ChangePasswordTemplate>
<table style="background-color:#bbccee;">
<tr>
<td align="right">Nåværende Passord:</td>
<td><asp:TextBox ID="CurrentPassword" TextMode="Password"
runat="server"></asp:TextBox></td>
<td>
<asp:RequiredFieldValidator ID="valRequireUsername"
SetFocusOnError="true"
Display="Dynamic"
ControlToValidate="CurrentPassword" runat="server"
ErrorMessage="Nåværende passord er nødvendig"
ValidationGroup="ChangePassword1" >*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">Nytt Passord:</td>
<td><asp:TextBox ID="NewPassword" TextMode="Password"
runat="server"></asp:TextBox></td>
<td></td>
</tr>
<tr>
<td align="right">Bekreft Passord:</td>
<td><asp:TextBox ID="ConfirmPassword" TextMode="Password"
runat="server"></asp:TextBox></td>
<td></td>
</tr>
<tr>
<td colspan="3">
<asp:Label ID="FailureText" EnableViewState="false"
runat="server" ></asp:Label>
<asp:ImageButton ID="ChangePassword"
CommandName="Submit" ImageUrl="~/Images/Go.gif" runat="server" />
</td>

</tr>
</table>
</ChangePasswordTemplate>
</asp:ChangePassword>

any suggestions?
Oct 9 '08 #5
yeah, thank you. That problem is solved.

right now I'm twisting my head with another PaswordRecovery problem;
If I click on the submit button without having entered a username, no error
message is displayed.

I thought the error should be displayed in the FailureText label, but it
isn't. The only thing displayed by the RequiredFieldValidator is that "*"

<asp:TableRow>
<asp:TableCell>Brukernavn:</asp:TableCell>
<asp:TableCell><asp:TextBox ID="UserName"
runat="server"></asp:TextBox></asp:TableCell>
<asp:TableCell Width="10" >
<asp:RequiredFieldValidator ID="valRequireUsername" SetFocusOnError="true"
Display="Dynamic" ControlToValidate="UserName" runat="server"
ErrorMessage="Brukernavn er påkrevd" ValidationGroup="pwdRecovery"
>*</asp:RequiredFieldValidator>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ColumnSpan="2" HorizontalAlign="Right">
<asp:Label ID="FailureText" runat="server"
EnableViewState="false"></asp:Label>
<asp:ImageButton ID="SubmitButton" ImageUrl="~/Images/Go.gif"
CommandName="Submit" ValidationGroup="pwdRecovery" runat="server" />
</asp:TableCell>
</asp:TableRow>

any suggetions?
Oct 9 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: com | last post by:
MS Access 2000 Password Recoverer 4.2 Screenshot - Soft30.com MS Access 2000 Password Recoverer will display the password to a MS Access database (*.mdb). This program works for MS Access files...
1
by: Rick Gamble | last post by:
When the password recovery control sends forgotten passwords via email I get the message noted below. Is there a way to decrypt this to make it usable to the user who requested it? Please...
4
by: clintonG | last post by:
When the password is hashed and most secure this control mails a new password to anybody that provides an authenticated user name. The previous password can no longer be used to login. The newly...
0
by: =?Utf-8?B?am1obWFpbmU=?= | last post by:
I'm trying to create a process that allows me to limit the non-alphanumeric characters generated with the PasswordRecovery control. Specially I want to suppress some characters for security...
1
by: jobs | last post by:
I'm using asp.net Membership security. Using the Password recovery control, users can reset/recover their passwords. Great. I've grid with all the users. I'd like to add a button so the admin of...
1
by: Me LK | last post by:
Unfortunately I am working on a site that started awhile ago in 1.1 and is just now being finished. This means I don't have all the features of 2.0 like the password controls. I am looking for some...
2
by: whitey | last post by:
Hi All, The following script works when username(or email) and password are in 1 table. what i need to know is how to adjust the code to reflect that the email will be held in tbl_email and the...
1
by: =?Utf-8?B?SHVzYW0=?= | last post by:
Hi : I have the following code that I used it in password recovery: Dim mail As New MailMessage() mail.From = New MailAddress("husam_108@yahoo.com") mail.To.Add("husamalahmadi@hotmail.com")...
1
by: gopi2ks | last post by:
Dear All I am using password recovery control,In this its automatically sending password to mail after configuring smtp,Now I need to restrict the password sending to email and i need to send...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.