Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>when application throws the exception, i am handling in Application_Error event. </p> <pre><code>protected void Application_Error(object sender, EventArgs e) { Exception ex = HttpContext.Current.Server.GetLastError(); if (ex.Message == "File does not exist." &amp;&amp; HttpContext.Current.Session == null) { if (((System.Web.HttpException)(ex)).GetHttpCode() == 404) { LogtheException(); } } else { Log the Exception(Session["uname"].ToString()); Server.Transfer(UrlMaker.ToError(ex.Message.ToString())); } } </code></pre> <p>Using HttpContext.Current.Server.GetLastError(); i am getting the last exception. If any exception, other than "File does not exist." is having the access to session variable.</p> <p>First it throws exception related to application, then if any css/image file path is not correct then immediately next it throws the "File does not exist." exception. The exception is because of not handling the sessions properly for "File does not exist." case.</p> <pre><code>Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the &lt;configuration&gt;\&lt;system.web&gt;\&lt;httpModules&gt; section in the application configuration. </code></pre> <p>Now I came to know that Css and image requests normally don't need to access the session, therefore asp does not load the session into memory and you don't have access to it on exception "File does not exist."..</p>
    singulars
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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