Welcome to WebmasterWorld Guest from 54.196.231.129

Forum Moderators: ocean10000

Message Too Old, No Replies

request.QueryString Disappearing + Please help

     
6:06 pm on Feb 7, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 11, 2002
posts:93
votes: 0


http://address?EID=52/B66-9865<+3<:<39;=236@,16

The request.QueryString("EID") is producing EID=52/B66-9865< 3<:<39;=236@,16, dropping the + symbol and adding a space.

Any ideas?

[edited by: encyclo at 8:02 pm (utc) on Feb. 7, 2006]
[edit reason] delinked [/edit]

6:34 pm on Feb 7, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 12, 2002
posts:1482
votes: 0


You need to use the Server.URLEncode() method (assuming you're using ASP) to escape the characters before placing them in the querystring.
4:50 pm on Feb 14, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 5, 2005
posts:134
votes: 0


Request.Querystring interprets a "+" (plus) sign as a space....which is especially annoying when you are doing querystring encryptions and never know whats going to pop up up there.

The solution is to ALWAYS include .Replace(" ", "+") when you request querystring

Example:


string s = Request.QueryString["id"].Trim().Replace(" ", "+");

Hope that helps
-Mike

5:33 pm on Feb 14, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 12, 2002
posts:1482
votes: 0


The solution is to ALWAYS include .Replace(" ", "+") when you request querystring

The solution is to always escape your characters (using Server.URLEncode()) before sending them on to another page. You can then use the Unescape() function in classic ASP, or you can use Server.URLDecode() in .NET. There's no reason to mess around with replacing a bunch of different characters. A space isn't the only thing that gets messed up in a QueryString.