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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:44:01+00:00 2026-06-02T15:44:01+00:00

In my ASP.NET MVC 3 application, when I check my remember me box in

  • 0

In my ASP.NET MVC 3 application, when I check my remember me box in my LogOn Action, It should create a persistent cookie, so that when I close my browser and re-open it I should still be logged in:

FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);

When I use Fiddler, I can see the Session ID is being sent like so:

Request sent 342 bytes of Cookie data:

ASP.NET_SessionId=<Session ID>; .ASPXAUTH=<Auth String>

But when I close my browser and re-open it, I’m still logged in but the Request doesnt send a Session ID:

Request sent 298 bytes of Cookie data:

.ASPXAUTH=<Auth String>

I then put Response.Write(Session.SessionID) in my Action and this changes every time I refresh the page once I’ve re-opened my browser. If I dont close my browser then the Session ID stays the same for every refresh.

I’m using the StateServer to hold the Session State as I thought this might solve the problem, as I also experienced it with InProc.

  • 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-02T15:44:02+00:00Added an answer on June 2, 2026 at 3:44 pm

    That’s expected behavior. The concept of setting an authorization cookie, and the concept of sessions are not the same thing. A session in ASP.NET is meant to live as long as the user has their browser open, because a session is stored in a per-session cookie.

    “…the SessionID value is stored in a non-expiring session
    cookie in the browser. (http://msdn.microsoft.com/en-us/library/ms178581.aspx)

    Having a persistent session is sort of a bad idea. Remember, the normal case for Sessions is that they are stored in memory. Would you really want to save the session of users in memory who haven’t logged in in a week? Any sort of “session” data you are trying to save that long should not be stored in a session, but in a persistent data store (read: database).

    Updated based on your comment

    Might I suggest you do something like this:

    public string GetMyCompany(){
      return Session["MyCompany"] = Session["MyCompany"] ?? GetMyCompanyFromDatabase();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Single Application Page Asp.net MVC 4 temlplate uses default database to check Login and
I have an asp.net mvc application with a route similar to: routes.MapRoute(Blog, {controller}/{action}/{year}/{month}/{day}/{friendlyName}, new
I'm building an ASP.NET MVC application with a form that needs validation. The majority
I am creating an ASP.NET MVC application that has postcode lookup functionality. I capture
I want to check render time of each page in asp.net mvc application. i
I currently have an ASP.NET MVC application that exists. I want to add a
In our ASP.NET MVC application, we've noticed that we cannot have The Forbidden DOS
My ASP.NET MVC application is a small part of a bigger ColdFusion app that
I'm working on an asp.net MVC application. I have a class that wraps a
I have an ASP.NET MVC 3 application, that resides in lets say localhost/myapp under

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.