variable to session variable

Results 1 to 2 of 2

Thread: variable to session variable

  1. #1
    Join Date
    Dec 1969

    Default variable to session variable

    Hi all,<BR><BR>I have a simple question. I have an authorisation script that when authorised, gives a user access to records in a database.<BR><BR>I wish to restrict access to their own records *records containing their username*. I would like to store the username as a session variable. Is this possible/wise?<BR><BR>I have gotten the username from a form, and set it by:<BR>strUserName = Request.Form("txtName"). What would be the correct syntax to pass it on to the session var? Would I be wasting my time with:<BR><BR>If Not rs.EOF Then<BR> Session("bolUserName") = & strUsername & <BR><BR>Am I far off track? Can anyone help? :))<BR><BR>Thanks for your time and patients :)<BR><BR>Take care :)<BR>Renee<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: variable to session variable

    What you have makes sense. You can store the Session variable like the following:<BR><BR>Session("bolUserName") = strUsername<BR><BR>and then in your database queries, you can add the condition:<BR><BR>"Where UserName = &#039" & Session("bolUserName") & "&#039"<BR><BR>Session vars are better than using querystrings or form posts to pass the ID around, because the latter can easily be worked around.<BR><BR>James

Posting Permissions

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