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 3841520
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:39:52+00:00 2026-05-19T15:39:52+00:00

I have configured an asp.NET web application to use forms authentication and store the

  • 0

I have configured an asp.NET web application to use forms authentication and store the session in a custom table. So far so good, when I log in the authentication persists across browser sessions. I am trying to get to grip with the possibilities of storing the session like so but I come up against a problem early on.

If I add variable/value pairs to the session object, and output the session variables to the page, the variable/value pairs are displayed as expected, but when I close and reopen the browser the correct session reloads as expected (which I confirm by outputting the sessionid) but the variable/value pairs are gone.

Is there something very simple I am missing here as from what I understand the session variables should also be available across browser sessions(strings are serializable right?).

List<SessionVar> sessionVars = new List<SessionVar>();
protected void Page_Load(object sender, EventArgs e)
{
    Session[Session.SessionID] = Session.SessionID;
    LoadSessionData();
}

protected void btnSessionVariable_Click(object sender, EventArgs e)
{
    Session[txtVariableName.Text.Trim()] = txtVariableValue.Text.Trim();
    txtVariableName.Text = string.Empty;
    txtVariableValue.Text = string.Empty;
    LoadSessionData();
}

private void LoadSessionData()
{
    sessionVars.Clear();
    foreach (string key in Session.Keys)
    {
        sessionVars.Add(new SessionVar(key, (string)Session[key]));
    }
    gridView.DataSource = sessionVars;
    gridView.DataBind();
}
  • 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-05-19T15:39:52+00:00Added an answer on May 19, 2026 at 3:39 pm

    Session state is NOT maintained when a browser (or browser tab) closes and is restarted.
    The session cookie is no longer available for the new browser window so a new session will start. That ASP.NET assigns the same id again is just a coincedence.

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

Sidebar

Related Questions

I have a Windows-Forms Application that I configured to use with an ASP.NET Service
I have this existing environment: 1) ASP.NET 3.5 web application 2) forms authentication with
I have an asp.net web app that uses forms-based authentication, a SqlMembershipProvider (using an
I have an existing ASP.NET application that implements Forms Authentication site-wide. The application is
I have an ASP.NET web application with a web forms projects with dependencies on
I have an existing ASP.NET web application. This ASP.NET web application uses JQuery to
I am using AspNetSqlMembershipProvider in my ASP .Net 4 web application project. I have
Have Log4Net configured in our application to use a date stamped name and a
I have written an ASP.NET MVC application that allows the user to specify their
I have been tasked to look after an ASP.Net WebForms application that communicates with

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.