sending session state through querystring

Results 1 to 2 of 2

Thread: sending session state through querystring

  1. #1
    Join Date
    Dec 1969

    Default sending session state through querystring

    I have a demo area that is password protected. When a user enters a valid username/password, this creates a session object called "verify".<BR><BR>If the user does not have a password, then they have to fill out a form to get into the demo. I know that I can send this information through the querystring by attaching it to the URL that the form is directed to, but how do I code the page to read these values and establish a session just as if the username/password approach was taken. And I still need the same page to process a username/password entry as it currently does.

  2. #2
    Join Date
    Dec 1969

    Default RE: sending session state through querystring

    Try testing for the session variable at the top of the page that gets the username and password. Even though it is obviously not there before the user enters their password (if they have one), this test will be useul when sending the user back to this page after they fill out the form if the do not have a password.<BR>Something like this:<BR><BR>If session("verify")=false then<BR> &#039code here that gets the username and password<BR> &#039if password accepted set session("verify")=true<BR> &#039if password fail &#039response.redirect(http://new-user-form.asp)<BR><BR> &#039display some link for those that are new to new-user-form<BR>end if<BR><BR>Then the rest of the demo page. If the correct password was enterd they will see this if not they will have been redirected to the new user form. <BR><BR>On the new user input form you just need to set the session("verify")=true after they have enterd their information. So after they have completed and submitted the form and you have done with it what you want:<BR>session("verify")=true<BR>response.redire ct("http://login-page.asp")<BR><BR>Now when they get to you login page they will have the session set to true and they will not see the login stuff this time. <BR><BR>If you have not used redirect before I will tell you it can be tricky. As soon as it is hit it is executed and you are off to the page specified by the redirect. All other script and html is not execute. It is common to mess up a couple of time. there should be plenty of information on this site about its use.<BR><BR>Good luck,<BR>todd.<BR>

Posting Permissions

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