Results 1 to 3 of 3

Thread: [RESOLVED] Session.Abandon

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2008
    Posts
    474

    Resolved [RESOLVED] Session.Abandon

    Code:
    protected void Page_Load(object sender, EventArgs e)
        {
           string sBeforeAbandon;
           string sAfterAbandon;
    
            sBeforeAbandon = Session["name"].ToString();
            Session.Abandon();
            if (Session["name"] != null)
            {
                sAfterAbandon = Session["name"].ToString();
             }
        }
    IN sBeforeAbandon I am getting "sonia". After that I write Session.Abandon(), But in sAfterAbandon I am still getting the "sonia". WHy Session.Abandon means destroys all the session objects, then why I am getting "sonia" after Session.Abandon()

  2. #2
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Session.Abandon

    Quote Originally Posted by MSDN
    When the Abandon method is called, the current Session object is queued for deletion but is not actually deleted until all of the script commands on the current page have been processed. This means that you can access variables stored in the Session object on the same page as the call to the Abandon method but not in any subsequent Web pages.
    MSDN - Session.Abandon Method
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2008
    Posts
    474

    Re: Session.Abandon

    Session.Abandon method is actually delete that session object completely when that current process is complete.
    In variable sAfterAbandon still “sonia” is dere, because FORM LOAD PROCEDURE IS NOT COMPLETED.



    SOLVED -- I AM not able to Mark the thread as Resolved!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width