Skip to main content

Posts

Showing posts from September, 2005

ASP .NET İpuçları

“Oluşan Hatayı Mail İle Kendinize Gönderin” Çalışan ASP .NET uygulamanızda hata oluştuğu zaman bu hatadan anında haberdar olmak için aşağıdaki kod parçası işinizi görecektir. Bu kodu Global.asax dosyasında Application_Error event’ına yazmalısınız. protected void Application_Error(Object sender, EventArgs e) { Exception ex = Server.GetLastError().GetBaseException(); string err = "Hata Oluştu !" + System.Environment.NewLine + "Hata: " + Request.Url.ToString() + System.Environment.NewLine + "Hata Mesajı: " + ex.Message.ToString() + System.Environment.NewLine + "Stack Trace: " + ex.StackTrace.ToString(); // Server.ClearError(); System.Web.Mail.MailMessage mm = new System.Web.Mail.MailMessage(); mm.To = "mgedik@verivizyon.com"; mm.From = " mgedik@verivizyon.com "; mm.Subject = "Sistemde Hata !"; mm.Body = err; try { System.Web.Mail.SmtpMail.SmtpServ...