Key problem with Request.QueryString

jpmcca01

New member
Joined
Oct 20, 2006
Messages
3
Programming Experience
3-5
I have a page with links on it. If you click on one of the links it calls another page that processes the querystring by using the Request.QueryString method. The url is the following:
http://localhost:8081/handleEvent.aspx?Action=ViewProduct&ProductID=0001

As you can see I should have 2 keys but when I do the following:
testlabel.Text = CStr(Request.QueryString("Action"))

The result is:
ViewProduct&ProductID=0001

So the hexadecimal is getting processed to the &, but it is not seperating it as a seperate key. Also if I try a Request.QueryString("ProductID") it acts like that key doesnt exist, which is probably why the above result happens.

How do I correct this so I can access the values by checking the keys? I could always parse it like a string, but that is a little bit annoying.:mad:

Thanks
 

jpmcca01

New member
Joined
Oct 20, 2006
Messages
3
Programming Experience
3-5
%26 is hex for &.
It gets converted by browsers to &.

Look at the output I pasted:
ViewProduct&ProductID=0001

Also this is comming from a xml/xsl transformation and xsl won't let you use the & sign, so you have to use %26. So considering it is converting it, it you should be able to get key and values via the querystring like normal.

If I am wrong then please help me to find another solution.
 

jpmcca01

New member
Joined
Oct 20, 2006
Messages
3
Programming Experience
3-5
Ok I figured out the solution after alot of searching. Needed to use "&" instead of "%26" for it to display "&". Looks like it was an encoding issue.
 
Top Bottom