Sending an xml file in HttpWebRequest

Discussion in 'ASP .Net' started by Roshawn Dawson, Sep 17, 2005.

  1. 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
     
    Roshawn Dawson, Sep 17, 2005
    #1
    1. Advertising

  2. Roshawn Dawson

    Joerg Jooss Guest

    Roshawn Dawson wrote:

    > 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,
    --
    http://www.joergjooss.de
    mailto:
     
    Joerg Jooss, Sep 18, 2005
    #2
    1. Advertising

  3. Thanks Joerg for the reply! This is just what I'm looking for. :)

    Joerg Jooss wrote:
    > Roshawn Dawson wrote:
    >
    >
    >>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,
     
    Roshawn Dawson, Sep 21, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TWFydmlu?=

    httpWebRequest not sending client Certificate

    =?Utf-8?B?TWFydmlu?=, Aug 6, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,721
    Jens Christian Mikkelsen
    Aug 8, 2004
  2. BuddyWork

    Sending XML via HttpWebRequest

    BuddyWork, Sep 29, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    26,201
    Joerg Jooss
    Sep 30, 2004
  3. Rob
    Replies:
    1
    Views:
    849
    bruce barker
    May 12, 2008
  4. Ying-CO
    Replies:
    0
    Views:
    840
    Ying-CO
    Jun 5, 2008
  5. Erik Wasser
    Replies:
    5
    Views:
    500
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page