Cookies & Session Variables

Results 1 to 2 of 2

Thread: Cookies & Session Variables

  1. #1
    Manoj Scaria Guest

    Default Cookies & Session Variables

    i am using session variables in my application.<BR>but i open a new window and coming back after setting a cookie.<BR>i am reading that cookie value in the first(main) window.<BR>but after that i am not able to use the session variables<BR>Why?

  2. #2
    Join Date
    Dec 1969

    Default RE: Cookies & Session Variables

    Hmm... Beggers the obvious question of why you&#039;re using a cookie... But I guess you want a more permanent storage of data than a session variable can handle.<BR><BR>Although I&#039;ve never experienced this problem, it could be down to the following...<BR><BR>When you start a session, it creates a cookie on the local users hard drive. This cookie contains the session ID of that session. This is how the server knows which session variable is for which connected client.<BR><BR>When you&#039;re writing your custom cookie to the hard drive, it may be overwriting the existing ASP Session ID. This way, when the client returns back to the server to get some information, the server doesn&#039;t know which session variables it wants...<BR><BR>Sound plausable?<BR><BR>As for a way around it... You can get the session ID from the session object... Although I&#039;m not 100% sure as to how it&#039;s actually stored in the cookie, you could try writing this back to the cookie at the same time as your custom data...<BR><BR>To do this, you would have to go to a website that uses sessions, check what the cookie looks like (how the session ID is stored), and then use this format to store the session ID...<BR><BR>Craig.

Posting Permissions

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