I am looking for documentation on IIS Express, specifically how to override the default 404 (not found) handling. When 404 happens, I want to redirect to my own page and do some special handling there.
I know this is possible in IIS 7 – is it possible also in IIS Express 7.5? If so, how is that done?
Thank you for your quick reply.
I did exactly as you suggested. Still getting the dreaded 404.0 error! I put a debug breakpoint in my NotFound.aspx file and it never gets called!
This works perfectly using the default Developer Web Server!
Took out the CustomErrors section from web.config, and put in this section in ApplicationHost.Config:
Saavik
Member
467 Points
457 Posts
Where can I find documentation on IIS Express - especially...
Feb 19, 2012 10:08 AM|LINK
I am looking for documentation on IIS Express, specifically how to override the default 404 (not found) handling. When 404 happens, I want to redirect to my own page and do some special handling there.
I know this is possible in IIS 7 – is it possible also in IIS Express 7.5? If so, how is that done?
Help is MOST APPRECIATED.
================
Saavik
Vipindas
Contributor
5514 Points
810 Posts
Re: Where can I find documentation on IIS Express - especially...
Feb 19, 2012 10:18 AM|LINK
http://forums.iis.net/p/1153365/1886004.aspx
http://blog.osbornm.com/archive/2011/05/27/asp.net-404-custom-errors-and-iis.aspx
http://www.iis.net/ConfigReference/system.webServer/defaultDocument
Ruchira
All-Star
42906 Points
7023 Posts
MVP
Re: Where can I find documentation on IIS Express - especially...
Feb 19, 2012 03:10 PM|LINK
Hi,
You can do it in the web.config file of your project. Edit the CustomErrors section as below.
<configuration> <system.web> <customErrors defaultRedirect="yourDefaultErrorPage.htm" mode="On"> <error statusCode="404" redirect="yourPageFor404.htm"/> </customErrors> </system.web> </configuration>You can use IIS forums to post your problems regarding IIS. Following link will help you to learn about IIS.
http://learn.iis.net/
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.Saavik
Member
467 Points
457 Posts
Re: Where can I find documentation on IIS Express - especially...
Feb 19, 2012 05:26 PM|LINK
Thank you for your quick reply.
I did exactly as you suggested. Still getting the dreaded 404.0 error! I put a debug breakpoint in my NotFound.aspx file and it never gets called!
This works perfectly using the default Developer Web Server!
Took out the CustomErrors section from web.config, and put in this section in ApplicationHost.Config:
<httpErrors errorMode="Custom" existingResponse="Replace" defaultPath="~/ServerError.aspx">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/NotFound.aspx" responseMode="ExecuteURL"/>
</httpErrors>
Now I get the error - cannot map path to '/'.
Ideas are most appreciated.
================
Saavik
Ruchira
All-Star
42906 Points
7023 Posts
MVP
Re: Where can I find documentation on IIS Express - especially...
Feb 20, 2012 04:07 AM|LINK
Hello,
You mean Cassini (Visual studio default web server)? Then on what server it's not working?
You better give it with ~ infront of it. I think there is a path issue.
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.Saavik
Member
467 Points
457 Posts
Re: Where can I find documentation on IIS Express - especially...
Feb 20, 2012 05:19 AM|LINK
Thanks for your quick reply.
This "version" of my many tries does not have ~ before the path, but, unfortunately, I have already tried it with ~ and the same error occurs.
================
Saavik