Handling 404 scenarios

Topics: Developer Forum
May 9, 2011 at 2:06 PM

Hi:

I need help on addressing 404 scenarios. Let me explain, whenever a page is not found(404 error), I want to write a rewrite/redirect rule where the end user to be redirected to a particular page.

 

For example if, www.abc.com/content/agriculture.aspx is not found, I want it to be redirected to www.abc.com/content/default.aspx

 

Please advise

Regards,

Swami

Coordinator
May 12, 2011 at 11:45 AM

Swami,

you don't need a rewriter like IIRF to make that happen.  Just configure the custom 404 handler in IIS.

In IIS7, read this article to find out more: http://learn.iis.net/page.aspx/267/how-to-use-http-detailed-errors-in-iis-70/

For IIS6, http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/80cb8d8d-8fd8-4af5-bb3b-4d11fff3ab9c.mspx

You can parameterize your custom handlers, so that they get the name of the page that was originally requested.  Or, you can just direct to "default.aspx". It's up to you.