I have a page that reveives a lot of incoming traffic. Some of these fail, and i want to redirect them to my main page to avoid losing potentional customers. I have tried this in my global.asax
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
Exception ex = Server.GetLastError();
if (ex is HttpException)
{
if (((HttpException)(ex)).GetHttpCode() == 404)
Server.Transfer("~/Default.aspx");
}
// Code that runs when an unhandled error occurs
Server.Transfer("~/Default.aspx");
}
And i tried using custom errors, but my application keeps giving me the IIS 7.5 HTTP 404 error page, even though i should have handled it myself.... Everything is working as intended in my development environment, but on my hosted solution is isnt working... any solutions?