homepage Welcome to WebmasterWorld Guest from 54.211.180.175
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

    
request.QueryString Disappearing + Please help
liquidstar




msg:951547
 6:06 pm on Feb 7, 2006 (gmt 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]

 

mattglet




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

You need to use the Server.URLEncode() method (assuming you're using ASP) to escape the characters before placing them in the querystring.

Argblat




msg:951549
 4:50 pm on Feb 14, 2006 (gmt 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

mattglet




msg:951550
 5:33 pm on Feb 14, 2006 (gmt 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved