Using Session Variables to Pass Values to other Pa

Results 1 to 2 of 2

Thread: Using Session Variables to Pass Values to other Pa

  1. #1
    Join Date
    Dec 1969

    Default Using Session Variables to Pass Values to other Pa

    I&#039m trying to use session variables to pass values to various html and ASP pages. I have a login page, then once the user logs in (using a form), their login ID customizes the home page. Depending on the user&#039s LoginID, I need to pass values from the home page to other pages on the site.<BR><BR>Anyway, my problem is, I&#039m confusing myself on which pages to put the session variables, etc. <BR><BR>Here&#039s what I&#039ve come up with:<BR><BR>&#060;%<BR>session("labid")=Request.F orm("frmLabID")<BR>%&#062;<BR><BR>then on the page(s) receiving this info:<BR><BR>&#060;%<BR>gotlabid=session("labid")< BR>%&#062; <BR><BR>So, first, where do I put the initial session variable, on the login page, or on the customized home page - that uses the labid to customize data? The login page only links to the home page, the home page links to all the other pages that need specific information. Then, do I put the "gotlabid" code on every page where I need customized information?

  2. #2
    Chris Willey Guest

    Default RE: Using Session Variables to Pass Values to othe

    The initial session variable should be set when the login is validated. Then, just refer to the session variable directly on every page you need it (or use an SSI page), no need to pass it to a local variable (unless you&#039re REALLY concerned about server resources, and even then...).<BR><BR>You should also use a bit of code to send the user to the login page if they don&#039t have the session variable.

Posting Permissions

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