Session State and cookies

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris Zopers

    Session State and cookies

    Hello,

    I've read somewhere that sessionstate does not work when a browser has
    disabled cookies, so I wanted to test this and did the following:

    I added two aspx pages (c#), in the first I set a session variable like
    this: Session["Test"] = "Hello";

    On the first page there is a button that navigates to the second page,
    like this: Server.Transfer ('Default2.aspx ');

    In the second page in the load event, I do this:
    Response.Write( Session["Test"];);

    After this, I disabled all cookies in my browser (internet explorer 6)
    bij using the privacy tab in IE Options. But after disabling the
    cookies, my project still works fine! How's this possible or am I
    understanding something wrong here?

    Greetings,
    Chris

    *** Sent via Developersdex http://www.developersdex.com ***
  • Anthony Jones

    #2
    Re: Session State and cookies

    "Chris Zopers" <test123test12@ 12move.nlwrote in message
    news:ulxurpVbIH A.3696@TK2MSFTN GP03.phx.gbl...
    Hello,
    >
    I've read somewhere that sessionstate does not work when a browser has
    disabled cookies, so I wanted to test this and did the following:
    >
    I added two aspx pages (c#), in the first I set a session variable like
    this: Session["Test"] = "Hello";
    >
    On the first page there is a button that navigates to the second page,
    like this: Server.Transfer ('Default2.aspx ');
    >
    In the second page in the load event, I do this:
    Response.Write( Session["Test"];);
    >
    After this, I disabled all cookies in my browser (internet explorer 6)
    bij using the privacy tab in IE Options. But after disabling the
    cookies, my project still works fine! How's this possible or am I
    understanding something wrong here?


    Most likely the site you are visiting is being seen as a member of the
    trusted or intranet zone (probably because you are not using a FQDN). IE
    will allow Session cookies for such sites regardless of your privacy
    settings.

    --
    Anthony Jones - MVP ASP/ASP.NET


    Comment

    • Aidy

      #3
      Re: Session State and cookies

      On the first page there is a button that navigates to the second page,
      like this: Server.Transfer ('Default2.aspx ');
      The Session object will work, it just won't "remember" between page calls.
      When you Server.Transfer you are still within the same page call so the
      values you set are still in the Session. Do a Response.Redire ct instead for
      a better test.


      Comment

      • Chris Zopers

        #4
        Re: Session State and cookies

        Okay, that should be the reason, because I tested this in my visual
        studio project.....tha nks!



        *** Sent via Developersdex http://www.developersdex.com ***

        Comment

        Working...