473,385 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

& 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 4856
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.de
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.de

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(string url, byte[] bytes, string contentType)
{
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url);
request.Method = "POST";
request.ContentLength = bytes.Length;
request.ContentType = contentType;
using (Stream requestStream = request.GetRequestStream())
{
requestStream.Write(bytes, 0, bytes.Length);
}

using (HttpWebResponse response =
(HttpWebResponse) request.GetResponse())
{
if (response.StatusCode != HttpStatusCode.OK)
{
string message = String.Format(
"POST failed. Received HTTP {0}", response.StatusCode);
throw new ApplicationException(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.GetBytes(xml);
PostBinary(url, bytes, "text/xml");

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

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

Similar topics

3
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...
12
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: ...
4
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. ...
15
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...
10
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...
1
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
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...
14
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...

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.