Monday, June 21, 2004

VJs Tip Of The Day - June 21st 2004

Redirecting to Default Error Html in case of Error

You might have many errors handled in your application but still there would be few of them always left out, so what's the solution??... Well here it is... Go and do the setting in the web.config file of your web application...
< customErrors defaultRedirect="UrProblemUnknownError.htm" mode="RemoteOnly" >
< error statusCode="404" redirect = "MyProblemServerNotFound.htm"/>
< /customErrors >

Now interesting fact is in conjunction to our previous tip on "SmartNavigation"... In case of pages for which you allow SmartNavigation the defaultRedirect does not work and Microsoft has confirmed it to be a bug... At the same time there is a work around...
Change your page directive a little bit when you use "SmartNavigation" as follows

< %@Page Language="C#" smartNavigation="True" ErrorPage="UrProblemUnknownError.htm" %>

The ErrorPage here will help you in that scenario... Don't ask me why so, You should not ask embarrassing questions... :-)

PS: I celebrate Mother's day today as it's my mom's birthday today... Happy Mother's Day!!

No comments: