To customize 404 handling and based on the hosting company's suggestion, we are currently using the following web.config setup. However, we quickly realized that with this configuration, any page error (500 error) are also getting redirected to this custom error page. How can I modify this config file so we can continue to handle 404 with custom file while still able to view on-page error?
Mark
How to configure your web.config to Redirect http to https - secure your for Asp.Net web pages on a windows servers A while back Google updated it's Chrome browser to display a warning if you visit a web page that isn't secure (loads using http). Since then, it's now become a basic requirement, to have an SSL Certificate for your domain that.
4 Answers
Try this -
The 404 error page is 404.html and it is located in my root, likewise the 500 page
Ayeni AyodejiAyeni Ayodeji
Classic ASP doesn't pass through the error in IIS7 by default. To enable that for a site, run the following from the command line, being sure to replace {sitename} with your name site:
c:windowssystem32inetsrvappcmd.exe set config '{sitename}' -section:system.webServer/httpErrors /existingResponse:'PassThrough' /commit:apphost
Additionally, make sure to turn off IIS friendly errors. They really aren't friendly.
Scott Forsyth - MVPScott Forsyth - MVP
I am discovering a lot of complicated work-arounds for Classic ASP in IIS 7.5 for dealing with IIS 6 type of custom error handling for a specific error code, typically 404. I hope this helps people who stumble upon it.
I am running IIS 7.5 R2 but I think this applies to IIS 7 in general.
If your web.config file has this in it:
...inside the IIS Manager you probably selected Edit Features under Error Pages to change the features on the Edit Error Pages Settings panel. If you change this to Custom Error Pages (customErrors mode='On'), you are forced to setup handling of each and every error number. So don't do that.
All you have to do is RIGHT click on the error number you wish to handle and select Edit. There you can point to a custom error page you create or redirect to a URL. Rather than create a custom error page that you have to remember to update when your site design or menus change, I always suggest redirecting to the home page and add something to the querystring like ?syserror which you can then handle from the home page. My technique is to check for this in the home page scripting and popup a friendly message letting them know their page was not found and they were directed to the home page.
Your web.config file would look something like this:
I also suggest that you do not enable detailed error messages on a production Website as a security precaution, even for local. Just look up the details in your system log.
Just my 2 cents, hope it helps and please let me know if you think I am incorrect on anything here.
SteffanieSteffanie
bmercer
protected by Tom O'ConnorJun 26 '13 at 7:05
Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
Would you like to answer one of these unanswered questions instead?