Saturday, October 18, 2014

forgot password code in

Posted by Gnani Palepu  |  No comments

 if you want more related search please click here  
 please help to other  

 simple forgot password code using  
 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:)  
 <asp:LinkButton ID="lkForgotPwd" runat="server" Font-Size="12px" >Forgot Password</asp:LinkButton>  
 <telerik:RadWindow runat="server" ID="winPending" Animation="FlyIn" Width="700px"  
           OpenerElementID="lkForgotPwd" VisibleOnPageLoad="false" Height="300px" Behaviors="Close"  
           Skin="Outlook" Title="Forgot Password">  
           <br />  
               <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 />  
                       <asp:Label runat="server" ID="lblemailid" Text="Enter email id" ForeColor="darkred"></asp:Label>  
                     <td colspan="2">  
                       <telerik:RadTextBox ID="txtEnteremailid" runat="server" ValidationGroup="lkForgotPwd">  
                       <asp:RequiredFieldValidator runat="server" ID="txtRvfHeader" ValidationGroup="lkForgotPwd"  
                         ForeColor="darkred" Font-Size="X-Small" ErrorMessage="Please enter emailid" ControlToValidate="txtEnteremailid">  
                     <td style="width: 150px;">  
                       <br />  
                     <td style="width: 100px;">  
                       <br />  
                        <asp:Button runat="server" ID="btnSubmitforgotpwd" Text="Submit" ValidationGroup="lkForgotPwd"  
                          Height="30px" CssClass="btn1" Width="75px" />  
                       <br />  
                         <asp:Button runat="server" ID="btnCancelforgotpwd" Text="Close" ValidationGroup="lkForgotPwd"  
                          CausesValidation="false" CssClass="btn1" Height="30px"  
                         Width="75px" />  
 function and logic ( add includes files mails)  
   #Region "forgot password"  
   Protected Sub btnSubmitforgotpwd_Click(sender As Object, e As System.EventArgs) Handles btnSubmitforgotpwd.Click  
       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 ", "", "")  
         '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  
       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)  
         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  
   End Sub  
 #End Region  

 if you want more related search please click here  
 please help to other  

11:36 PM Share:


Get updates in your email box
Complete the form below, and we'll send you the best coupons.

Deliver via FeedBurner
Proudly Powered by Blogger.
back to top