Results 1 to 6 of 6

Thread: AGGGHHH session's

  1. #1

    Thread Starter
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696

    Angry

    Hi Guys and Gals

    I Have an ASP page that takes about 20 different values from a Query string. I grab them all into one container as follows

    Dim Params
    Set Params = Request.Querystring

    I Then store the object in the session using
    session("Ihatethissession") = Params

    The problem is that when I use another page and try to retrieve this Object I can't get to the values.

    Iv'e tried the following with no success

    Dim Getparams

    Set Params = session("Ihatethissession")

    or

    Dim Getparams

    Set Params = Request.Querystring
    Params = session("Ihatethissession")

    When I try to retrieve a value using params("myvalue")
    It keeps on saying a type missmatch

    If any one can help

    Most appreciated

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Ian

    It looks a though the QueryString is treated as a normal string once it has been put in a session variable


    I expect you've beat me to it but I've just knocked up a function to return the required section of a string
    Code:
    function getRequest(Qstring,section)
    	dim strTemp
    	dim i
    	i = instr(Qstring,section)
    	if i > 0 then
    		strTemp = Mid(Params,i + len(section)+1 )
    		i = instr(strTemp,"&")
    		if i > 0 then
    			strTemp = left(strTemp,i-1)
    		end if
    	end if
    
    	getRequest = strTemp
    end function
    Mark
    -------------------

  3. #3

    Thread Starter
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    Cheers Mark

    I didn't even think about the easy option that it got turned into normal string again.

    Once again thanks.

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  4. #4

    Thread Starter
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    Hi again Mark

    Just for information, I did use your code because I couldn't be bothered to write it myself. If you need to use it for yourself, I would change this :

    i = instr(Qstring,section)
    if i > 0 then
    strTemp = Mid(Params,i + len(section)+1 )

    to
    i = instr(Qstring, "&" & section & "=")
    if i > 0 then
    strTemp = Mid(Qstring,i + len(section) + 2)

    It removes any errors when there are lots of variables that are simular

    Cheers

    Ian

    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  5. #5
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    That's a good point Ian

    Also I rather embarisingly left "Params" in the code which I was using before I split it off into a function!


    Mark
    -------------------

  6. #6

    Thread Starter
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    No worries
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

Posting Permissions

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



Click Here to Expand Forum to Full Width