In the global.asax Application_error Event write the following code
VB.NET
Dim ex As Exception = Server.GetLastError().GetBaseException()
If TypeOf ex Is System.IO.FileNotFoundException Then
’your code
’Response.Redirect('err404.aspx')
Else
’your code
End If
C#
Exception ex = Server.GetLastError().GetBaseException();
if (ex.GetType() == typeof(System.IO.FileNotFoundException))
{
//your code
Response.Redirect ('err404.aspx');
}
else
{
//your code
}
Share with