if you want more related search please click here
please help to other
http://scriptquery.blogspot.in/
simple forgot password code using vb.net
--------------------------------------------------:
Remember here clsSvt is my connection change to your connecttion string it will work other wise it willnot working.
first you have to check the database names like (usercode,username,password,)
step 1:)
--------
linkbutton
<asp:LinkButton ID="lkForgotPwd" runat="server" Font-Size="12px" >Forgot Password</asp:LinkButton>
radwindow
<telerik:RadWindow runat="server" ID="winPending" Animation="FlyIn" Width="700px"
OpenerElementID="lkForgotPwd" VisibleOnPageLoad="false" Height="300px" Behaviors="Close"
Skin="Outlook" Title="Forgot Password">
<ContentTemplate>
<br />
<center>
<fieldset style="border-style: solid; border-width: 1px; border-color: gray; width: 450px;
height: 200px;">
<legend style="font-weight: bold; margin-left: 15px; color: black; font-size: 15px;
margin-left:-180px;"><span style="vertical-align: middle;">
<img src="../../Images/NewIcons/sms_icon.png" /></span> <span style="vertical-align: top;">
<b>Forgot password</b></span> </legend>
<br />
<table>
<tr>
<td>
<asp:Label runat="server" ID="lblemailid" Text="Enter email id" ForeColor="darkred"></asp:Label>
</td>
<td colspan="2">
<telerik:RadTextBox ID="txtEnteremailid" runat="server" ValidationGroup="lkForgotPwd">
</telerik:RadTextBox>
<asp:RequiredFieldValidator runat="server" ID="txtRvfHeader" ValidationGroup="lkForgotPwd"
ForeColor="darkred" Font-Size="X-Small" ErrorMessage="Please enter emailid" ControlToValidate="txtEnteremailid">
</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td style="width: 150px;">
<br />
 
</td>
<td style="width: 100px;">
<br />
<asp:Button runat="server" ID="btnSubmitforgotpwd" Text="Submit" ValidationGroup="lkForgotPwd"
Height="30px" CssClass="btn1" Width="75px" />
</td>
<td>
<br />
<asp:Button runat="server" ID="btnCancelforgotpwd" Text="Close" ValidationGroup="lkForgotPwd"
CausesValidation="false" CssClass="btn1" Height="30px"
Width="75px" />
</td>
</tr>
</table>
</fieldset>
</center>
</ContentTemplate>
</telerik:RadWindow>
function and logic ( add includes files mails)
#Region "forgot password"
Protected Sub btnSubmitforgotpwd_Click(sender As Object, e As System.EventArgs) Handles btnSubmitforgotpwd.Click
Try
Session.Clear()
Dim cmdStr As String = Nothing
cmdStr = "select EMailID,UserCode,UserName,PWD from MstWebUser where EMailID ='" & txtEnteremailid.Text & "'"
Dim dt As DataTable = clsSvt.getDATATable(cmdStr)
If dt.Rows.Count > 0 Then
Dim strtomail As String = dt.Rows(0)("EMailID").ToString()
Dim strBody As String = "Dear " + dt.Rows(0)("UserName").ToString() & " <br/> User Code " & dt.Rows(0)("UserCode").ToString() & "<br/> <br/> Your Password : " & dt.Rows(0)("PWD").ToString() & "<br/> <br/> <br/> With Regards,<br/> Support Team. "
SendMailToCustomer(strtomail, strBody)
txtEnteremailid.Text = String.Empty
RadWindowManagerAlert.RadAlert("Mail has been sent successfully.", 330, 150, " Valid emailid ", "", "")
Else
'Lblerr.Text = "Invalid Password"
txtEnteremailid.Text = String.Empty
RadWindowManagerAlert.RadAlert("Mail has not been sent successfully.", 330, 150, " Invalid emailid ", "", "")
End If
Catch ex As Exception
End Try
End Sub
Public Function SendMailToCustomer(ByVal argSendMailID As String, ByVal strBody As String) As Boolean
Dim newMail As New System.Net.Mail.MailMessage()
If (argSendMailID.Contains("@")) Then
newMail.To.Add(argSendMailID)
Dim UserName As String = System.Configuration.ConfigurationManager.AppSettings("gmailSendmailid").ToString()
newMail.From = New MailAddress(UserName)
Dim Password As String = System.Configuration.ConfigurationManager.AppSettings("gmailSendPassword").ToString()
newMail.Body = strBody
newMail.IsBodyHtml = True
newMail.Subject = "Forgot password"
Dim newSmtp As New SmtpClient(System.Configuration.ConfigurationManager.AppSettings("SmtpClient").ToString())
newSmtp.EnableSsl = True
newSmtp.Port = System.Configuration.ConfigurationManager.AppSettings("PortNumber").ToString()
newSmtp.Credentials = New System.Net.NetworkCredential(UserName, Password)
Try
newSmtp.Send(newMail)
Return True
Catch ex As Exception
ViewState("alert") = ex.Message.Replace("'", " ")
Return False
Exit Function
End Try
End If
Return False
End Function
Protected Sub btnCancelforgotpwd_Click(sender As Object, e As System.EventArgs) Handles btnCancelforgotpwd.Click
Response.Redirect(Common.SvtNavigationPage.login)
End Sub
#End Region
if you want more related search please click here
please help to other
http://scriptquery.blogspot.in/
11:36 PM
Share:
0 comments: