Session Variable

Results 1 to 2 of 2

Thread: Session Variable

  1. #1
    Gonzalo Paternoster Guest

    Default Session Variable

    I want to make a session variable so I can tack banner ads I have on the web and have that variable go with the visit throughout the web site until they order and have that recorded on the order form.<BR><BR>The ad goes to a link like this:<BR><BR><BR>The page that it that them to has the following script:<BR>&#060;%<BR> Dim tAffiliate<BR> tAffiliate = Request.QueryString("Affiliate")<BR> Response.Write ("This sale will be credited to Affiliate # " & tAffiliate & "&#060;P&#062;")<BR>%&#062;<BR><BR>But than when I go to a different page I made that has this script to write the variable it does not pull it up:<BR>&#060;%<BR> Response.Write ("This sale will be credited to Affiliate # " & tAffiliate & "&#060;P&#062;")<BR> %&#062;<BR><BR>Please help!

  2. #2
    Join Date
    Dec 1969

    Default RE: Session Variable

    You never set a session variable. Try this: session("tAffiliate")=request.querystring("affilia te")<BR><BR>Then whenever you refer to it (on any page) use session("tAffiliate")<BR><BR>If you refer to it more than once or twice on a single page then set a variable on that page to the seesion("taffiliate"). Something like tmpAffiliate=session("taffiliate"). You do not have to do this but it would save processing time for the server. <BR><BR>You also need to check for the existence of the session("taffiliate") if you have code on several pages that set its value. Something like:<BR>if session("taffiliate") = "" then<BR> (execute code to set session)<BR>end if<BR>if it already contains a value then we do not want to reset it.<BR><BR>Session variables are very useful. They have their drawbacks as well. Some will try to talk you out of using them. One reason is that they do not work if the user has the cookies setting in their browser turned off. It is not the end of the world though most people probably have their browser set to accept cookies. If it is critical part of your application then show a message telling them about the cookies setting. You can test for this behind the scenes in script also. This site should has all of that info to read up on.<BR><BR>Good luck,<BR>todd.

Posting Permissions

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