can i redirect from the global.asax to controller action?

Viewed 14011

i am trying to show an error page when the user uploads a file that is over the limit (see Catching "Maximum request length exceeded")

in the global.asax i want to redirect to a controller action, so something like thisbut it does not work ?:

private void Application_Error(object sender, EventArgs e)
{
    if (GlobalHelper.IsMaxRequestExceededEexception(this.Server.GetLastError()))
    {
        this.Server.ClearError();
        return RedirectToAction("Home","Errorpage");
    }
}
1 Answers
Related