Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my Project,we are handling WEB API exceptions in Global.asax file (redirecting to Error page if any error occurs).
Its working fine when i run in local.Its not working if i deploy the code in the server.

C#
protected void Application_Error(object sender, EventArgs e)
        {
            Response.Clear();

            Response.Redirect("~/Error.aspx");
            // Clear the error from the server
            Server.ClearError();
        }

web.config changes
<customErrors mode="Off"/>


Is there any other way we can redirect it to error page.
Please let me know how to fix it.

Thank you all in advance

What I have tried:

I tried to implement some changes like Changing IIS7 server into classic mode and others
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900