Link to home
Start Free TrialLog in
Avatar of ANAT2403
ANAT2403Flag for Israel

asked on

application error in global.asax

In AS{.NET 2.0 with C# I  have an errorpage and in global.asax I added to Application_Error to print the error in an errorpage I defined.
I have some problems:
first I have to run the application in the mode without debugging otherwise it get to the application error all the time.
second if I run without the debugging not all the errors are catched.
How does tthis function work?
ASKER CERTIFIED SOLUTION
Avatar of strickdd
strickdd
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
 void Application_Error(object sender, EventArgs e)
    {
        try
        {
            Server.Transfer("~/ExceptionPage.aspx", false);
        }
        catch { ;}
    }

and in exceptionpage.aspx.cs page_load

 if (ex != null)
{
    //
}
Avatar of ANAT2403

ASKER

Hi nisarkhan,
What do you mean by
if (ex != null)
{
    //
}
where ex comes from?
Anat
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,
What is the difference and what is prefered between
System.Web.HttpContext.Current.Response.Redirect("ErrorPage.aspx");
and
Server.Transfer("~/ErrorPage.aspx", true);
Thankyou
Anat
the diff is response.rediect vs server.transfer

http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=15