session variables and cookies

Results 1 to 2 of 2

Thread: session variables and cookies

  1. #1
    Graham Tilson Guest

    Default session variables and cookies

    I know that session variables are implemented via cookies, but the cookie is not actually written to the hard disk, as session variables still work with cookies disabled. But do they still work with browsers that don&#039t support cookies at all, like a set top box?

  2. #2
    Join Date
    Dec 1969
    Posts
    2,849

    Default RE: session variables and cookies

    Session variables use cookies when you create a session variable on one page and try to reference it on another. Session variables inside a single ASP page do not use cookies. So, disable cookies and create two ASP files. In ASPFile1.asp, put the following code:<BR><BR>&#060;% Session("Hello") = "World!" %&#062;<BR><BR>Then, in ASPFile2.asp, put:<BR>&#060;% Response.Write "Hello, " & Session("Hello") %&#062;<BR><BR>You&#039ll note that the session variables do not persist from one page to the next if you have cookies disabled. (If you are using IE5, you have to disable "per-session" cookies.

Posting Permissions

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