ASP.Net/Session Cookie/Application Error — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 15:30, 26 мая 2010
In case of application error send out email (VB.net)
<%@ Import Namespace="System.Web.Mail" %>
<script language="VB" runat="server">
Sub Application_Error(sender As Object, e As EventArgs)
Dim ex As Exception = Server.GetLastError()
If Not ex Is Nothing Then
Dim Mail as New MailMessage()
"Change the values below to valid email addresses
"Mail.To = <valid email address>
"Mail.From = <valid email address>
Mail.Subject = "error"
Mail.Body = "An Exception occurred in page " & _
Request.RawUrl & ":" & vbCrLf
Mail.Body &= ex.ToString() & vbCrlf & vbCrlf
Mail.Body &= "was handled from Application_Error."
"If your SMTP server is not local, change the property below
" to a valid server or domain name for the SMTP server
SmtpMail.SmtpServer = "localhost"
SmtpMail.Send(Mail)
Server.ClearError()
End If
End Sub
</script>