我有這樣的自定義錯誤在我的web.config文件重定向但它似乎並沒有工作,因爲我加入了redirectMode="ResponseRewrite"
自定義404錯誤不正確重定向
它工作正常的500錯誤,但不是404(它只是當我有一個404)
不重定向下面是web.config
<customErrors mode="On" redirectMode="ResponseRewrite">
<error statusCode="404" redirect="/servererror/default.aspx" />
<error statusCode="500" redirect="/servererror/default.aspx" />
</customErrors>
的代碼,這是我的servererror/default.aspx
代碼
Dim err As System.Exception = Server.GetLastError()
Dim Errormail = New MailMessage
'Send email to Bondholder using email address from form
Errormail.To = "[email protected]"
Errormail.From = "[email protected]"
Errormail.Subject = "Server Error Alert"
Errormail.BodyFormat = MailFormat.Text
Errormail.Priority = MailPriority.Normal
Errormail.Body = ("Error on page - " & err.InnerException.Message & vbcrlf & vbcrlf & "URL of the page - " & Request.Url.ToString())
SmtpMail.SmtpServer = "localhost"
SmtpMail.Send(Errormail)
我需要保持redirectMode="ResponseRewrite"
使得servererror/default.aspx
給我發來電子郵件時有一個錯誤
任何幫助,將不勝感激
感謝
傑米
UPDATE
我看了一下網頁,發現不少其他人有相同的問題,但我找不到明確的答案。
任何想法
感謝
傑米
如果你試圖打開nonexistingpage.htm它不應該工作的免費應用程序頁面的HTTP狀態代碼,這是怎麼回事,除非如果你使用IPM。 – Tomasi 2010-09-27 14:37:45
什麼是IPM?對不起,我是一個新手 – 2010-09-27 15:38:58