473,811 Members | 2,540 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C#, asp website: problem with of HttpRequest.Que ryString ("+" char decoded to space)

17 New Member
I have a problem with HttpRequest.Que ryString.

There is an XML string that contains something like the following: <age>8+</age>
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:

Expand|Select|Wrap|Line Numbers
  1. NameValueCollection coll = Request.QueryString;
  2. XMLstring = coll.Get("XMLstr");    // result: XMLstring = "<age>8 </age>"
Expand|Select|Wrap|Line Numbers
  1. XMLstring = Request.QueryString["XMLstr"];    // result: XMLstring = "<age>8 </age>"
Expand|Select|Wrap|Line Numbers
  1. XMLstring = Request.QueryString.Get("XMLstr");    // result: XMLstring = "<age>8 </age>"
Expand|Select|Wrap|Line Numbers
  1. XMLstring = HttpUtility.HtmlDecode(Request.QueryString["XMLstr"]);    // result: XMLstring = "<age>8 </age>"
Expand|Select|Wrap|Line Numbers
  1. XMLstring = HttpUtility.HtmlDecode(Request.QueryString.Get("XMLstr"));    // result: XMLstring = "<age>8 </age>"
** note: XMLstring is a string (decleration: string XMLstring = "";)


I realise I can just search XMLstring and replace the space with the plus sign. I don't want to do that :)
Also, this isn't my code, and I have no idea why XML is in QueryString nor if it should be there, but it
has to stay like this for the moment, and I have to somehow extract that + sign.

Any help/advice is appreciated.
Thank you.
Apr 7 '08 #1
2 3181
kunal pawar
297 Contributor
u can used HTMLEncode or HTMLDecode functions provided in server object
Apr 8 '08 #2
Plater
7,872 Recognized Expert Expert
Yes, you will need to encode your XML string BEFORE it gets to the querystring I believe.
Apr 8 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
11984
by: milkyway | last post by:
Hello all, This is a little frustrating ;-( I have the following used as part of Javascript code. I am trying to send values from the client to the server following the information from this web site: http://www.netomatix.com/HttpPostData.aspx But what I have found is that the code below generates an error and does not seem to work.
13
4350
by: - Steve - | last post by:
I've been given a school assignment and while everything else is easy there's one topic I'm completley lost on. I've been given an ASCII file that looks like this. During start-up, the program needs to read an ASCII data file of inventory records and build an appropriate dynamic data structure using structs and pointers. 10112 MICROPROCESSOR 2100 2 B 000008.50 000012.50 10235 CHARACTER_PRINTER 4013 4 C 000995.00 001295.00 10450...
1
4890
by: Mark Miller | last post by:
I just recently started getting the above error on a page I am posting MULTIPART/FORM-DATA. We have SoftArtisans FileUp component and Filter installed on the server in question and up until a day or so ago everything was working fine. I honestly can't remember changing anything since it was last working. But I tried reinstalling the .Net Framework along w/ the service pack, which didn't work. I also had v1.1 already installed but I hadn't...
7
2676
by: Drew Berkemeyer | last post by:
I've encounted a pretty strange problem and I'm not quite sure what to make of it. I have a web service that consumes an XML file as well as a few other parameters. This web service works fine if I use the web test interface. It also works fine if I call it from an ASP.NET page that has a text box where the XML is pasted and then passed on. However, I get an exception if I use an <input type="file"> control on the ASP page that allows...
2
5073
by: Tom | last post by:
I'm getting this error when I try to pass a structure to a dll. An unhandled exception of type 'System.ArgumentException' occured in Test1.exe Additional Information: Type could not be marshaled because the length of an embedded array instance does not match the declared length in the layout What does it mean?
2
1918
by: Vjay77 | last post by:
How to grab html code from remote website? can someone help? please let me know... vjay
1
2940
by: EoRaptor013 | last post by:
Not sure where to ask this question, but... I'm using a TreeView component to enable browsing file folders in a specific directory (for test purposes /Program Files/). Some users use an ampersand ("&") in both folder and file names. This has caused me some real grief! I'm not in a position to tell the users it's an ID 10 T error and they have to change their file and folder names. In VS2K5, I have debugged my code and found that ...
2
2295
by: shantanu | last post by:
Hi All I need to update some data on a web page through the httpwebrequest. For which i am writing the code below . Kindly tell me where the flaw is as it is not updating the values. Thanks and regards Shantanu WebNetCred = new System.Net.NetworkCredential("test","test123");
5
1225
by: mark4asp | last post by:
I have a website written in asp.net 1.1 Is it possible to convert it to asp.net 2.0 There is no solution or project file. I'm using VS2005.
0
9730
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10651
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10403
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10136
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3868
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3020
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.