Tôi không biết tại sao Response.Redirect không hoạt động đúng khi tôi triển khai mã của mình lên IIS7? Trang lỗi trắng/vàng luôn được hiển thị thay vì tệp Errors.aspx của tôi. Nhưng khi gỡ lỗi chạy bằng cách sử dụng Visual Studio trên máy tính của tôi, nó chạy tốt?ASP.Net Response.Redirect không hoạt động trong Application_Error?
protected void Application_Error(object sender, EventArgs e)
{
ILog log = LogManager.GetLogger(typeof(Global).Name);
Exception objErr = Server.GetLastError().GetBaseException();
log.Error(objErr);
string err = "Error Caught in Application_Error event\n" +
"\nError Message:" + objErr.Message.ToString() +
"\nStack Trace:" + objErr.StackTrace.ToString();
EventLog.WriteEntry("Kiosk", err, EventLogEntryType.Error);
Server.ClearError();
Response.Redirect("~/Error.aspx", false);
}
nếu bạn đính kèm một debugger, bạn có thể đột nhập vào mã tại xem Response.Redirect được thực sự được gọi là? –
tốt, tôi gỡ lỗi bằng cách sử dụng Visual Studio trên máy tính của tôi và nó chạy tốt. Nhưng khi triển khai vào IIS, nó không chạy nữa – Leo