.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> Javascript >> Post New Resource Bookmark and Share   

 Subscribe to Articles

How to redirect to error page : Javascript - a practical scenario

Posted By:Gaurav Arora       Posted Date: April 28, 2009    Points: 25    Category: Javascript    URL: http://www.dotnetspark.com  
 

My readers enquired that how to rehuffle the yellow page on web. 
The Yellow page appears when Web-Site got any runtime error.

I always suggested to supercede the Yellow-Page. Try the following code :



namespace AStepAhead.redirectErrorPage
{
public class redirectErrorPage
{
public redirectErrorPage()
{
String strDomainName = "MsDotnetHeaven.com";
try
{
//Write you coding here
}
catch (Exception ex)
{
SystemFramework.ApplicationLog.WriteError("Error : " + ex.ToString());
//Redircet you main page to error page
Response.Write("\n");
Response.End();
}
}
}

}


Now, in error page, read ErrorString and show to the users.

Step(s): Followings are the steps to perform above:

1. Create an Error Page and named it as errorpage.aspx.
2. Read Error string at Page_load
3. Write above code in your Web Page.


After above, whenever any runtime exception occured, your user will see a maintained / designed error page.
 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend