add a global.asax file to your project , and there , in
protected void Application_Error(object sender, EventArgs e)
{
}
and make a page to redirect user to that page.
but if you want basically solve this problem , in important actions use try catch statement to handle each error separately!