Mega Code Archive

 
Categories / ASP.Net / Login Security
 

Recovers a forgotten password and emails it back to the user

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> </head> <body>     <div id="pageContent">         <form id="form1" runat="server">             <asp:PasswordRecovery  ID="PasswordRecovery1"                                     runat="server"                                     BackColor="#F7F6F3"                                     BorderColor="#E6E2D8"                                     BorderPadding="4"                                     BorderStyle="Solid"                                     BorderWidth="1px"                                     Font-Names="Verdana"                                     Font-Size="0.8em"                                     OnSendingMail="PasswordRecovery1_SendingMail">                 <MailDefinition Subject="Password Recovery" From="d@d.com"></MailDefinition>                 <InstructionTextStyle Font-Italic="True" ForeColor="Black" />                 <SuccessTextStyle Font-Bold="True" ForeColor="#5D7B9D" />                 <TextBoxStyle Font-Size="0.8em" />                 <TitleTextStyle BackColor="#5D7B9D"                                  Font-Bold="True"                                  Font-Size="0.9em"                                  ForeColor="White" />                 <SubmitButtonStyle BackColor="#FFFBFF"                                     BorderColor="#CCCCCC"                                     BorderStyle="Solid"                                    BorderWidth="1px"                                     Font-Names="Verdana"                                     Font-Size="0.8em"                                     ForeColor="#284775" />             </asp:PasswordRecovery>         </form>     </div> </body> </html> File: Default.aspx.cs using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Net.Mail; public partial class Default : System.Web.UI.Page {     protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)     {         MailMessage m = e.Message;     } }