PDA

Click to See Complete Forum and Search --> : AGGGHHH session's


Ianpbaker
Jul 12th, 2000, 06:29 AM
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

Mark Sreeves
Jul 12th, 2000, 09:18 AM
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


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

Ianpbaker
Jul 12th, 2000, 09:31 AM
Cheers Mark

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

Once again thanks.

Ian

Ianpbaker
Jul 12th, 2000, 10:24 AM
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

Mark Sreeves
Jul 12th, 2000, 01:59 PM
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!

Ianpbaker
Jul 12th, 2000, 04:26 PM
No worries :D :D