Click to See Complete Forum and Search --> : Mappings in IIS for .NET


techieman
06-07-2006, 09:04 AM
Hi,

In my application, I want to redirect user to a specific error page when a wrong page name is given in URL. What I have done is following in web.config of my website:

<customErrors mode="On" defaultRedirect="Errors/errorpage.aspx">

<error statusCode="404" redirect="Errors/HTTPErrors.aspx"/>

</customErrors>

It works fine for .aspx files. But what about files with other extensions e.g. .htm. So for this I have added following piece of code in web.config of my website:

<httpHandlers>

<add verb="*" path="*.htm" type="System.Web.StaticFileHandler" />

</httpHandlers>

But its not working... I guess I need to map extension to ASP.NET isapi in IIS. i.e. IIS->Website->Configuration->Mapping-> ADD

But in this dialog box for adding the details Ok button is shown disabled..

So what to do now?
If any one has any idea then please help me ASAP...

TheBearMay
06-07-2006, 09:14 AM
Have you looked at the Custom Errors tab in the site's properties page?

techieman
06-08-2006, 01:24 AM
I mapped the custom page with error number 404 in Custom Error tab in IIS. It works.... But is it not possible n e other way, i.e. programatically?
ASPX pages are served by aspnet_isapi.dll, so redirection done in web.config for error page works fine for it. But static pages like html, css... etc are served directly by IIS, right? So redirection in web.config does not work with them.... As I said previously, configuring in IIS works fine, but cn this be done programatically in our website for html and other such pages?
Waiting for reply........