problem with HttpRequest.QueryString
-
I have a problem with HttpRequest.QueryString. There is an XML string that contains something like the following: 8+ As you probably guessed, the "+" is the problem :) I want to get that XML string from QueryString, however, the "+" appears as a " " (space), not a "+". I have tried the following:
NameValueCollection coll = Request.QueryString; XMLstring = coll.Get("XMLstr"); // result: XMLstring = "8 "
XMLstring = Request.QueryString["XMLstr"]; // result: XMLstring = "8 "
XMLstring = Request.QueryString.Get("XMLstr"); // result: XMLstring = "8 "
XMLstring = HttpUtility.HtmlDecode(Request.QueryString["XMLstr"]); // result: XMLstring = "8 "
XMLstring = HttpUtility.HtmlDecode(Request.QueryString.Get("XMLstr")); // result: XMLstring = "8 "
In all of the above cases, XMLstring is a string (string XMLstring = ""; ). I realise I can just search XMLstring and replace the space with the plus sign. I don't want to do that though. Also, this isn't my code, and I have no idea why XML is in QueryString nor if it should be there, never worked with asp or done web stuff in C#, but it has to stay like this for the moment, and I have to somehow extract that + sign. Any help or advice is appreciated. Thanks. -
I have a problem with HttpRequest.QueryString. There is an XML string that contains something like the following: 8+ As you probably guessed, the "+" is the problem :) I want to get that XML string from QueryString, however, the "+" appears as a " " (space), not a "+". I have tried the following:
NameValueCollection coll = Request.QueryString; XMLstring = coll.Get("XMLstr"); // result: XMLstring = "8 "
XMLstring = Request.QueryString["XMLstr"]; // result: XMLstring = "8 "
XMLstring = Request.QueryString.Get("XMLstr"); // result: XMLstring = "8 "
XMLstring = HttpUtility.HtmlDecode(Request.QueryString["XMLstr"]); // result: XMLstring = "8 "
XMLstring = HttpUtility.HtmlDecode(Request.QueryString.Get("XMLstr")); // result: XMLstring = "8 "
In all of the above cases, XMLstring is a string (string XMLstring = ""; ). I realise I can just search XMLstring and replace the space with the plus sign. I don't want to do that though. Also, this isn't my code, and I have no idea why XML is in QueryString nor if it should be there, never worked with asp or done web stuff in C#, but it has to stay like this for the moment, and I have to somehow extract that + sign. Any help or advice is appreciated. Thanks.dfn wrote:
never worked with asp or done web stuff in C#,
If this is C#, this is ASP.NET, not asp. And, we have a forum for ASP.NET questions.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
I have a problem with HttpRequest.QueryString. There is an XML string that contains something like the following: 8+ As you probably guessed, the "+" is the problem :) I want to get that XML string from QueryString, however, the "+" appears as a " " (space), not a "+". I have tried the following:
NameValueCollection coll = Request.QueryString; XMLstring = coll.Get("XMLstr"); // result: XMLstring = "8 "
XMLstring = Request.QueryString["XMLstr"]; // result: XMLstring = "8 "
XMLstring = Request.QueryString.Get("XMLstr"); // result: XMLstring = "8 "
XMLstring = HttpUtility.HtmlDecode(Request.QueryString["XMLstr"]); // result: XMLstring = "8 "
XMLstring = HttpUtility.HtmlDecode(Request.QueryString.Get("XMLstr")); // result: XMLstring = "8 "
In all of the above cases, XMLstring is a string (string XMLstring = ""; ). I realise I can just search XMLstring and replace the space with the plus sign. I don't want to do that though. Also, this isn't my code, and I have no idea why XML is in QueryString nor if it should be there, never worked with asp or done web stuff in C#, but it has to stay like this for the moment, and I have to somehow extract that + sign. Any help or advice is appreciated. Thanks.