473,594 Members | 2,651 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

& delimeter in query string

Hello,
I want to make an http post request to a site. I want to pass a
paramaeter having xml such as report=<abc>abc </abc> to it. When I try to do
this, is gives exception. And If send report=<abc>abc </abc>, it takes report
as empty string as it assumes & as delimeter. So how can I pass as xml in
http post request.

Thanks,
Sushi
Nov 17 '05 #1
4 4864
You can't send <,> symbol through querystring.
So you have to replace and send with some other character and againg you
have change that.

For Example: report=@abc!abc @/abc!

then you have to replace the querystring value as
"@abc!abc@/abc!".Replace(" @","<").Replace ("!",">")

Regards,
Amal
"sushi" wrote:
Hello,
I want to make an http post request to a site. I want to pass a
paramaeter having xml such as report=<abc>abc </abc> to it. When I try to do
this, is gives exception. And If send report=<abc>abc </abc>, it takes report
as empty string as it assumes & as delimeter. So how can I pass as xml in
http post request.

Thanks,
Sushi

Nov 17 '05 #2
sushi wrote:
Hello,
I want to make an http post request to a site. I want to pass a
paramaeter having xml such as report=<abc>abc </abc> to it. When I try
to do this, is gives exception. And If send report=<abc>abc </abc>, it
takes report as empty string as it assumes & as delimeter. So how can
I pass as xml in http post request.


If you do a HTTP POST, you can put your payload in the request body.

Cheers,

--
http://www.joergjooss.de
mailto:ne****** **@joergjooss.d e
Nov 17 '05 #3
But how to send data through the HttpWebRequest class object. I am using
HttpWebRequest class so as to send an HTTP Post request.

Thanks

"Joerg Jooss" wrote:
sushi wrote:
Hello,
I want to make an http post request to a site. I want to pass a
paramaeter having xml such as report=<abc>abc </abc> to it. When I try
to do this, is gives exception. And If send report=<abc>abc </abc>, it
takes report as empty string as it assumes & as delimeter. So how can
I pass as xml in http post request.


If you do a HTTP POST, you can put your payload in the request body.

Cheers,

--
http://www.joergjooss.de
mailto:ne****** **@joergjooss.d e

Nov 17 '05 #4
sushi wrote:
But how to send data through the HttpWebRequest class object. I am
using HttpWebRequest class so as to send an HTTP Post request.


Write your data to the request stream.

Here's a sample method that allows you post any kind of binary contents:

public void PostBinary(stri ng url, byte[] bytes, string contentType)
{
HttpWebRequest request = (HttpWebRequest ) WebRequest.Crea te(url);
request.Method = "POST";
request.Content Length = bytes.Length;
request.Content Type = contentType;
using (Stream requestStream = request.GetRequ estStream())
{
requestStream.W rite(bytes, 0, bytes.Length);
}

using (HttpWebRespons e response =
(HttpWebRespons e) request.GetResp onse())
{
if (response.Statu sCode != HttpStatusCode. OK)
{
string message = String.Format(
"POST failed. Received HTTP {0}", response.Status Code);
throw new ApplicationExce ption(message);
}
}
}

Assuming you have an XML string "xml", a target URL "url", and you want
to use UTF-8 encoding, all you need to do is

byte[] bytes = Encoding.UTF8.G etBytes(xml);
PostBinary(url, bytes, "text/xml");

Cheers,
--
http://www.joergjooss.de
mailto:ne****** **@joergjooss.d e
Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1585
by: JohnK | last post by:
doing some research on regional settings, .Net & DB I put my machine in Germany(Germany) thus the decimal char = "," the seperator char = "." so I set up the database for a test in .Net I'm using Access. a field (double) contains 45,56 I read the record using DataReader
12
6316
by: ~~~ .NET Ed ~~~ | last post by:
Hi, I have a standalone XML file (with the appropriate xml document header) that works fine when I load it using XmlDocument. I can have child elements like this without problems: <SomeChildElement type="c" href="There.aspx?id=5" /> But as soon as I change it to something like this: <SomeChildElement type="c" href="There.aspx?id=5&amp;t=m" />
4
8248
by: Trevor Balcom | last post by:
Hello, I am new to C# and cannot figure out how to do something simple. How can I build two strings out of a DateTime object? I need one string to contain the DateTime's date in YYMMDD format. The other string should contain the DateTime's time in HHMMSS format. Both strings should always return a length of 6 characters (they should have leading zero if neccessary to pad each field out to two digits). There should be no delimeter...
15
1830
by: Bart | last post by:
Hi, I receive an utf8 character from a database, like 田 (Japanese Character, style: &#XXXXX). How can I visualize the Japanese character on my application? I have found the class System.Text.Encoding, but the input looks like \uXXXX. I don't know how to do. Thank you,
10
1508
by: Claud Balls | last post by:
I am splitting large files based on a text delimeter, but I don't want the delimeter left out of the string. For example if I had a string "NAME: Bill TOWN: Helena NAME: Frank TOWN: Helena" I would want to split on NAME: giving me s(0) = NAME: Bill TOWN: Helena s(1) = NAME: Frank TOWN: Helena *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
1
2198
by: Voronkov Konstantin | last post by:
Hello all! std::ostringstream stream; stream << 8080; std::string str = stream.str(); // str == "8 080" The code shown above in mine big program result the str variable value to
3
1549
by: Marina | last post by:
Ok here's my problem.... I have a custom dialog box that allows the user to enter information to run a Parameter Query. This works GREAT, but I need that query to show as a form, not just the basic query screen. I have created the form, but how in the world do I get it to open based on the parameter query created by the user. Ugg... ok now even I'm confused... what a tangled web we weave... GRRRRR
14
5918
by: Arne | last post by:
A lot of Firefox users I know, says they have problems with validation where the ampersand sign has to be written as &amp; to be valid. I don't have Firefox my self and don't wont to install it only because of this, so I hope some of you gurus can enlighten me with this :) In what circumstances can the "&amp;" in the source code be involuntary changed to "&" by a browser when or other software, when editing and uploading the file to the web...
0
8246
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...
0
6652
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...
1
5738
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5404
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();...
0
3854
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3895
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2383
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1476
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1205
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.