Sending an xml file in HttpWebRequest

R

Roshawn Dawson

Hi,

I'm attempting something new, so please here me out.

I need to send an xml file in my HttpWebRequest object. IOW, I need to post some xml data to a
specified URI. (FYI, this xml is composed using the StringBuilder object.) After reading the docs,
it seems that the only place to do so is the ContentLength property.

The ContentLength property's data type is long. How do I convert the xml into long? Is there some
technique to use that does this automatically? Or is there an easier way to accomplish this task?

Thanks,
Roshawn
 
J

Joerg Jooss

Roshawn said:
Hi,

I'm attempting something new, so please here me out.

I need to send an xml file in my HttpWebRequest object. IOW, I need
to post some xml data to a specified URI. (FYI, this xml is composed
using the StringBuilder object.) After reading the docs, it seems
that the only place to do so is the ContentLength property.

Why on earth...? ContentLength defines the size of the request body in
octets. If you want to post data, write it to the request stream.
The ContentLength property's data type is long. How do I convert the
xml into long? Is there some technique to use that does this
automatically? Or is there an easier way to accomplish this task?

Check out http://tinyurl.com/ble8x

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top