Note that there are some explanatory texts on larger screens.

plurals
  1. PORedirect Does not work in Global.asax publish time
    primarykey
    data
    text
    <p>I add custom error exception in Global.asax. It works on debug mode but when I publish it in IIS 7.0 it does not work: Global.asax: </p> <pre><code> void Application_Error(object sender, EventArgs e) { // Code that runs when an unhandled error occurs //Ramezani V4.5: Change0002 29-08-91 if (Context.AllErrors[0].InnerException != null) { try { bool IsValid = (Session["ExceptionHandler"] == null); ArisFramWork.ExceptionHandler handler = new ArisFramWork.ExceptionHandler(Request.AppRelativeCurrentExecutionFilePath, (Context.AllErrors[0] == null ? new Exception("No Error Found") : Context.AllErrors[0])); Session["ExceptionHandler"] = handler; string redirectURL = (IsValid ? Request.AppRelativeCurrentExecutionFilePath : "~/ExceptionHandler.aspx"); Response.Redirect((Request.QueryString.Count == 0 ? redirectURL : redirectURL + "?" + Request.QueryString.ToString())); } catch { Session["ExceptionHandler"] = null; } } else { Response.Redirect("~/FileAccess.aspx"); } } void Application_Start(object sender, EventArgs e) { FastReport.Utils.Config.WebMode = true; // Code that runs on application startup //Ramezani V4.5: Change0002 29-08-91 //if (Context.Handler is IRequiresSessionState || Context.Handler is IReadOnlySessionState) Session["ExceptionHandler"] = null; } </code></pre> <p>In ExceptionHandler.aspx:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { try { publicclass.MessageBox("Hello ExceptionHandler", this); if (Session["ExceptionHandler"] != null) { if(ExceptionHandlerBulletedList.Items.Count==1) ExceptionHandlerBulletedList.Items.RemoveAt(0); List&lt;ArisFramWork.ExceptionHandler&gt; ExecutionCollection = (List&lt;ArisFramWork.ExceptionHandler&gt;)Session["ExceptionHandler"]; if (ExecutionCollection.Count &lt; 1) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "CloseForm", "window.close();", true); return; } ..... Session["ExceptionHandler"] = null; } } catch (Exception exception) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "CloseForm", "window.close();", true); } } </code></pre> <p>When I run website in debug Mode via Visual Studio 2010 it is work but it does not redirect to ExceptionHandler.asax in Publish Mode</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload