|
Il presente articolo è stato tradotto manualmente. Passare il puntatore sulle frasi nell'articolo per visualizzare il testo originale.
|
Traduzione
Originale
|
Evento ChangePassword.SendMailError
Assembly: System.Web (in System.Web.dll)
<%@ Page Language="C#" AutoEventWireup="True" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> void MySendingMail(object sender, MailMessageEventArgs e) { Message1.Text = "Sent mail to you to confirm the password change."; } void MySendMailError(object sender, SendMailErrorEventArgs e) { Message1.Text = "Could not send email to confirm password change."; // The MySamplesSite event source has already been created by an administrator. System.Diagnostics.EventLog myLog = new System.Diagnostics.EventLog(); myLog.Log = "Application"; myLog.Source = "MySamplesSite"; myLog.WriteEntry( "Sending mail via SMTP failed with the following error: " + e.Exception.Message.ToString(), System.Diagnostics.EventLogEntryType.Error); e.Handled = true; } </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>ChangePassword including a SendMailError Event</title> </head> <body> <form id="form1" runat="server"> <div style="text-align:center"> <h1>ChangePassword</h1> <asp:LoginView ID="LoginView1" Runat="server" Visible="true"> <LoggedInTemplate> <asp:LoginName ID="LoginName1" Runat="server" FormatString="You are logged in as {0}." /> <br /> </LoggedInTemplate> <AnonymousTemplate> You are not logged in </AnonymousTemplate> </asp:LoginView><br /> <asp:ChangePassword ID="ChangePassword1" Runat="server" BorderStyle="Solid" BorderWidth="1" CancelDestinationPageUrl="~/Default.aspx" DisplayUserName="true" OnSendingMail="MySendingMail" OnSendMailError="MySendMailError" ContinueDestinationPageUrl="~/Default.aspx" > <MailDefinition BodyFileName="~\MailFiles\ChangePasswordMail.htm" Subject="Activity information for you"> <EmbeddedObjects> <asp:EmbeddedMailObject Name="LoginGif" Path="~\MailFiles\Login.gif" /> <asp:EmbeddedMailObject Name="PrivacyNoticeTxt" Path="~\MailFiles\PrivacyNotice.txt" /> </EmbeddedObjects> </MailDefinition> </asp:ChangePassword><br /> <asp:Label ID="Message1" Runat="server" ForeColor="Red" /><br /> <asp:HyperLink ID="HyperLink1" Runat="server" NavigateUrl="~/Default.aspx"> Home </asp:HyperLink> </div> </form> </body> </html>
#region Using directives using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; #endregion namespace CreateEventSource { class Program { static void Main(string[] args) { try { // Create the source, if it does not already exist. if (!EventLog.SourceExists("MySamplesSite")) { EventLog.CreateEventSource("MySamplesSite", "Application"); Console.WriteLine("Creating Event Source"); } // Create an EventLog instance and assign its source. EventLog myLog = new EventLog(); myLog.Source = "MySamplesSite"; // Write an informational entry to the event log. myLog.WriteEntry("Testing writing to event log."); Console.WriteLine("Message written to event log."); } catch (Exception e) { Console.WriteLine("Exception:"); Console.WriteLine("{0}", e.ToString()); } } } }
Nota sulla sicurezza |
|---|
<html>
<head><title></title></head>
<body>
<form>
<h1>Your password for the account named "<%Username%>" has changed.</h1>
<p>
If you did not initiate this change, please call 1-206-555-0100.
</p>
<p>
<a href="http://www.contoso.com/login.aspx">
<img src="cid:LoginGif" alt="Log In" />
</a>
</p>
<p>
Please read our attached Privacy Notice.
</p>
</form>
</body>
</html>
Windows 7, Windows Vista SP1 o versione successiva, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (componenti di base del server non supportati), Windows Server 2008 R2 (componenti di base del server supportati con SP1 o versione successiva), Windows Server 2003 SP2
.NET Framework non supporta tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.
Nota sulla sicurezza