To Session or not to Session

Results 1 to 3 of 3

Thread: To Session or not to Session

  1. #1
    Join Date
    Dec 1969

    Default To Session or not to Session

    Scenario: I want a visitor to enter an ID in a form field when he/she enters and on submit reload the page so that the visitor is still on the currently browsed page but the ID is now captured. I then want to pass this ID from page to page while the visitor is surfing. <BR>What I’ve tried was this:<BR><BR>&#060;form action="javascript:location.reload()" method="post"&#062;<BR>&#060;input type="Text" size="12" name="UVID"&#062;<BR><BR> &#060;input type="Submit" value="Enter"&#062;<BR>&#060;/form&#062;<BR><BR>On all pages I have the following code:<BR><BR>&#060;%<BR>Dim UVID<BR>UVID = Request("UVID") %&#062;<BR><BR>&#060;% If UVID = "" Then %&#062;<BR>&#060;% Session("ThisSession") = "" %&#062;<BR>&#060;% Else %&#062;<BR>&#060;% Session("ThisSession") = UVID %&#062;<BR><BR>I’m not sure whether this session syntax is OK but I know that the UVID is not captured when the Enter button is clicked because I cannot Response.Write the UVID on the reloaded page.<BR>I would also like to know whether this Session(“ThisSession”) will work the way I have it.<BR><BR>Thanks a lot<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: To Session or not to Session

    ummm.<BR><BR>why not just put the mypage.asp in the form action?<BR><BR>you are using the session correctly,<BR>not sure about that code however, but it looks like it will work.<BR><BR>(Session vars are fine if you are not dealing with tons of hits.)

  3. #3
    Join Date
    Dec 1969

    Default You can simply keep the

    "action" of the form as that page name itself.<BR>&#060;form action="self.asp" method="post"&#062;<BR><BR>Then when you submit, the page will be reloaded and your code will work. Anyway, there doesnt seem to be any problem with the assignment of session variable. <BR><BR>Another question: How would you let the user go to some other page, would it be through a "link", because the "action" of the form is set to the same page ?

Posting Permissions

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