Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7867459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:43:21+00:00 2026-06-03T00:43:21+00:00

Each Page in a website including Error page is Derived from Master page. In

  • 0

Each Page in a website including Error page is Derived from Master page. In Master Page I am accessing the Session variables. When i get the Exception, handling in Page_Error or Application_Error Events. From there i am redirecting to the Error page using Server.Transfer, then i am getting this below exception in master page of Error.aspx. if i use Response.Redirect it works properly.

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 <configuration>\<system.web>\<httpModules> section in the application configuration.

please explain whats the problem with Server.Transfer in Detail.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T00:43:22+00:00Added an answer on June 3, 2026 at 12:43 am

    when application throws the exception, i am handling in Application_Error event.

    protected void Application_Error(object sender, EventArgs e)
        {
            Exception ex = HttpContext.Current.Server.GetLastError();
            if (ex.Message == "File does not exist." && 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()));
            }
        }
    

    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.

    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.

    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 <configuration>\<system.web>\<httpModules> section in the application configuration.
    

    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.”..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Each page on my website is rendered using PHP. Each PHP file uses around
I have a website with 3 pages, while each page has articles that are
I'm building a website using Drupal. On the header of each page I want
I noticed that a website like imgur.com displays ads on each page of the
I have a website with several servlets. Each page like index, about, FAQ, contact
I want to run a code on each page of my website, before the
I have tried a session.php script which runs at the head of each page
I have a website where each page contains a few frames. I recently started
all. I am required to build a website with each page under 130kb. I
I'm building a small-scale website (a personal one) in which each page would have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.