IIS7 web.config custom error page?
I'm used to working on a Apache2 server where I could use htaccess to set up things such as custom error pages and am trying to apply the same practice with a web.config file on IIS7.
I think the problem is my lack of understanding of IIS7 setup in general. I have a server set up using php5 and everything is working fine. When on apache dev server I would have something like www.mydomain.com/testsites/site1 and then site2, site3... and so on. And I would just drop a htaccess file in the root of the site in question.
The "default site" in IIS7 is what complicates things for me. I have gone and dropped all my test sites into the root of www which is accessed by the default site however even if I set custome error pages up in "site1" through IIS manager I still get the IIS7 error pages. Do I have to use the manager and create a different site bound to a different port for every test site or can I just put everything in the www directory this way?
I've found many articles through google but the terminology is beyond my current comprehension as all the solutions revolve around asp.net, dotnet3.5, asp, aspx, etc.
So I'm wondering can someone tell me as if I was totally new, what, where, and how, do I need to do/change besides putting my web.config file in the root of site1 to keep IIS7 from overriding the custom errors setup I have in my web.config.
Thanks to anyone who doesnt' mind taking the time to walk me through this in steps.
By the way, I got this from one of the articles and modified it to the actual path of my error page and then put it in the root of site1 with the "error_pages" directory.
<customErrors mode="On" defaultRedirect="/error_pages/404_page_not_found.html">
<error statusCode="404" redirect="/error_pages/404_page_not_found.html"/>
I tried creating a virtual directory pointing to site1 and then set the error page settings in IIS manager and it changed my web.config file to this
but it still is using the default IIS 404 page
<add key="customeErrors" value="/error_pages/" />
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/error_pages/404_page_not_found.html" responseMode="ExecuteURL" />
You might have to put the drive letter in the path...
Thanks for the suggestion Zeldaboy, but I tried ralative, absolute, and external url in the path and neither of them work. I've read where others have problems with this not working with IIS7 and in some cases IIS6 and apparently there is some over-complicated process because both IIS and the .net framework are involved but I haven't found a step by step how-to yet.
Rather than guessing since that's what I've been doing for 2 days I'm hoping to find someone who has successfully done this to break down the steps including any server config that may be required. (As if I just installed IIS7 and am working on my first site).
The more I read the more confused I am. Is creating a new site instead of the default site required? Does it have to be an application? Do I have to package a site? iis.net is talking some crazy stuff compared to Apache.
Maybe this is all required to be able to use a web.config file? I did manage to get it to give me an error about the config file at one point last night which means is is recognizing the existence of the web.config file in the site root.
I found out earlier the httpErrors defaultPath attrib was locked in the IIS configuration editor but it would only allow me the "lock" option. I fixed that by deleting the defaultPath attrib manually from the applicationhost.config file and was then able to set feature properties to "custom" and set the path to the error page. But now it just goes to googles oops page and doesn't even show the IIS7 404 page.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)