DeveloperSection

Home / DeveloperSection / Forums / How can I tell if Request/Response is available in Application_Error?

How can I tell if Request/Response is available in Application_Error?

Anonymous User 2547 01-Jun-2015

If Application_Error is triggered by an exception in the application. RouteConfigor BundleConfig.

how can you check if the Request/Response is available?

Response.Clear throws System.Web.HttpException with additional information Response is not available in this context.

void Application_Error(object sender, EventArgs e)
{
    //Log error
    Log.Error(e);
    //Clear
    Response.Clear();
    Server.ClearError();
    //Redirect
    Response.Redirect('~/Error');
}

 


Updated on 01-Jun-2015
I am a content writter !

Leave Answer


Please enter your answer.


1 Answers

Liked By