My web I have this custom error redirect in the config file, but I think that <500 works well for errors, but not for 404 (this is just when I do not get redirected to 404)
Here is the code from web.config
& lt; CustomErrors mode = "at" redirectMode = "ResponseRewrite" & gt; & Lt; Error status code = "404" redirect = "/ avoidance / default.aspx" /> & Lt; Error status code = "500" redirect = "/ seperate / default.aspx" /> & Lt; / CustomErrors & gt;
And here my servicererror / default.aspx
code
Dim as System.Exception = Server.GetLastError () Dim Errormail Send email to the bondholder using the e-mail address from the new mailmessage '' Aeromail Form. Eromel Firm = "serverrror@mil.co.uk" Erramarmel. Shoes = "Server Error Alert" ArrayMail.bodformat = Mailformat. Text ErreMail Priority = Mail Preference general error. Body = ("Error on page -" & amp; Error.International Message and VBCRLF and VBCRF & Page URL - & Request URL ToString ()) SmtpMail.SmtpServer = "localhost" SmtpMail.Send ( Errormail)
I need to keep redirectMode = "ResponseRewrite"
so that prevents / default.aspx
sends me an email When any error occurs
Any help will be highly appreciated
thanks
Jamie
UPDATE
I have taken a look around the web and Is found on very few other people have the same issues, but found I could not find a definitive answer.
Any Idea
Thanks
Jamie
I think you are generic Can not find the page when looking at NET?
The solution is as follows for the path as follows:
& lt; CustomErrors mode = "at" redirectMode = "ResponseRewrite" & gt; & Lt; Error status code = "404" redirect = "~ / servicererror / default.aspx" /> & Lt; Error status code = "500" redirect = "~ / servicererror / default.aspx" /> & Lt; / CustomErrors & gt; Update: When your solution works, it's a little bit - especially in the way you have used session status on a large scale application or Should be thrown in between other more experienced developers I suggest that 500 and 404 errors are divided into separate pages.
If your website is available through the web then it is useful for displaying different error messages to the real users, that is, if they are viewing the page (404) or some temporary problems (500 ) And can be a good idea to check back later. Every page on the text of the error should consider it as follows. It is also important to report the appropriate status code of the search engine whether a page is no longer available i.e. it has been removed from your project and should be removed from the search engine index or if there is an error and the search engine Let's back later to crawl the page and do not drop from the index. If these status codes are not reported correctly, then the performance of your web app may be corrupted through search engines. Usually my web. The configured read as:
& lt; CustomErrors mode = "redirect" = "response rivet" defaultRedirect = "~ / GenericError.aspx" & gt; & Lt; Error status code = "404" redirect = "~ / NotFound.aspx" /> & Lt; / CustomErrors & gt;
Note: It is important to set the "defaultRedirect" attribute due to the security hole discovered recently within the .NET Framework (Ask Google). This setting is an alternative solution for plugging the hole.
You can use the code below to report the appropriate HTTP status code back to the customer (and search engine bots). Just place them in the page load event of the relevant page:
For 500 errors:
feedback. Status = "500 Internal Server Error"
For 404 errors:
Feedback Status = "404 Not Found"
Now you can extract the code from Global. And create a shared function for your error email argument that can be asked from each page. If you want, you can merge the above code into your existing error page, though I always like to split it out because I have found it.
If you want to test the HTTP status codes of your pages, take a look at a free application called
Comments
Post a Comment