ERROR面的教,在等...............
ASP.NET程式行的候,出很多提示。
我把web.confg指定了一error.aspx的面。
我要怎才能抓出不同面示的呢?
急。。。。。在等...............
[解决办法]
可以通过Global.asax来实现
void Application_Error(object sender, EventArgs e)
{
Exception objErr = Server.GetLastError().GetBaseException();
string error = "发生异常页: " + Request.Url.ToString() + "<br>";
error += "异常信息: " + objErr.Message + "<br>";
Server.ClearError();
Application["error"] = error;
Response.Redirect("~/ErrorPage/ErrorPage.ASPx");
}
ErrorPage.aspx
protected void Page_Load(object sender, EventArgs e)
{
ErrorMessageLabel.Text = Application["error"].ToString();
}