Link to home
Start Free TrialLog in
Avatar of escheider
escheider

asked on

Determining Exception Type

In my application, I am using the global.asax's Application_Error to manage all unhandled exceptions -- essentially, I log the exception and redirect the user to specified error page.  

I have introduced a new entry point into my application that requires two parameters.   If either of the parameters are not available, I throw a custom exception to specifically identify this new error type.   The problem is, I'm not sure how to differentiate in the global.asax between this specific exception [I've defined it as MonthlyBreakdownException] and all other exceptions.      How can I obtain the specific error type [MonthlyBreakdownException] in my code below?

I'm using Visual Studio 2005, C#
Here is my code that I'm using currently:
 
        Exception ex = Server.GetLastError().GetBaseException();
        Logger.LogError(ex);
 
//I'd like to check for my new error here//
 
        if (Session["sessionId"] == null)
        {
            Response.Redirect("SystemTimeout.aspx", true);
        }
        else
        {
            Response.Redirect("LandingPage.aspx?sessionid=" + "none", true);
         }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of williamcampbell
williamcampbell
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
Avatar of escheider
escheider

ASKER

Thanks .. didn't realize it was that simple.