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

  • Home
  • SEARCH
  • 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 5947603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:59:14+00:00 2026-05-22T16:59:14+00:00

Session.Clear(); Session.Abandon(); Session.RemoveAll(); System.Web.Security.FormsAuthentication.SignOut(); I am doing this much code still HttpContext.Current.Session[User] is not

  • 0
        Session.Clear();
        Session.Abandon();
        Session.RemoveAll();

        System.Web.Security.FormsAuthentication.SignOut(); 

I am doing this much code

still

HttpContext.Current.Session["User"]  is not null

🙁

  • 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-22T16:59:15+00:00Added an answer on May 22, 2026 at 4:59 pm

    You don’t need to call both Clear and RemoveAll. Here’s how the RemoveAll is implemented:

    public void RemoveAll()
    {
        this.Clear();
    }
    

    Also here’s a quote from KB 899918:

    When the Web application requires a
    logon and offers a log off page or
    option, we recommend that you clear
    the session state when the user has
    logged off the Web site. To clear the
    session state, call the
    Session.Abandon method. The
    Session.Abandon method lets you flush
    the session state without waiting for
    the session state time-out. By
    default, this time-out is a 20-minute
    sliding expiration. This expiration is
    refreshed every time that the user
    makes a request to the Web site and
    presents the session ID cookie. The
    Abandon method sets a flag in the
    session state object that indicates
    that the session state should be
    abandoned. The flag is examined and
    then acted upon at the end of the page
    request. Therefore, the user can use
    session objects within the page after
    you call the Abandon method.
    As soon
    as the page processing is completed,
    the session is removed.

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

Sidebar

Related Questions

I have a ASP.Net application in my login page I call FormsAuthentication.SignOut Session.Abandon() Session.Clear()
I would like to know the difference between Session.clear(); Session.Abandon(); Session.RemoveAll(); Please explain the
Both Session.Clear() and Session.Abandon() get rid of session variables. As I understand it, Abandon()
I set a session like this: request.session['mykey']= 33 How do I clear it? I
I been using Session.clear() and I noticed in firecookie that the session still exists.
What is the difference between Session.Abandon() and Session.Clear() in ASP.Net?
Is there a difference between Session.Clear() and Session.RemoveAll() ? The descriptions and documentation pages
Collection.clear() will delete children whenever Session flushes. What about OneToOne? Setting to null is
I can't seem to find it anywhere... How do I delete/destroy/reset/empty/clear a user's session
Session variables are apparently not working for me. I don't know what I'm doing

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.