WebClient Class Method=Post

Discussion in 'ASP .Net' started by Paul J. Lay, May 13, 2004.

  1. Paul J. Lay

    Paul J. Lay Guest

    I am sending and receiving multipart messages using the WebClient UploadData
    method Method=Post. Everything seems to work well except when the URL
    contains parameters. For example:
    http://www.someURL.com?parm1=data1&parm2=data2. I don't believe these
    paramters are transmitted as part of the URL with the HTTP Post interface. I
    was under the impression that the WebClient class automatically handled
    these parameters for POST. The documentation doesn't cover this. Is this
    correct? If not, how should the user handle them. Please advise. Thanks
    for your help.

    Best Regards,

    Paul J. Lay
    Paul J. Lay, May 13, 2004
    #1
    1. Advertising

  2. Paul J. Lay

    avnrao Guest

    method POST - access the posted variables using html form (like
    Request.Form). in this case the values have to be part of the Form.
    method GET - access the posted variables using Request.QueryString[]

    Av.

    "Paul J. Lay" <> wrote in message
    news:...
    >I am sending and receiving multipart messages using the WebClient
    >UploadData
    > method Method=Post. Everything seems to work well except when the URL
    > contains parameters. For example:
    > http://www.someURL.com?parm1=data1&parm2=data2. I don't believe these
    > paramters are transmitted as part of the URL with the HTTP Post interface.
    > I
    > was under the impression that the WebClient class automatically handled
    > these parameters for POST. The documentation doesn't cover this. Is this
    > correct? If not, how should the user handle them. Please advise. Thanks
    > for your help.
    >
    > Best Regards,
    >
    > Paul J. Lay
    >
    >
    >
    avnrao, May 13, 2004
    #2
    1. Advertising

  3. If you using POST method parameters are not attached to URL.
    They only attached to URL when using GET
    With WebClient you suppose to use method UploadData but i have never been
    using it.

    I have always been using HttpWebRequest for that type of jobs. This class
    seems to be more flexible.

    George.


    "Paul J. Lay" <> wrote in message
    news:...
    > I am sending and receiving multipart messages using the WebClient

    UploadData
    > method Method=Post. Everything seems to work well except when the URL
    > contains parameters. For example:
    > http://www.someURL.com?parm1=data1&parm2=data2. I don't believe these
    > paramters are transmitted as part of the URL with the HTTP Post interface.

    I
    > was under the impression that the WebClient class automatically handled
    > these parameters for POST. The documentation doesn't cover this. Is this
    > correct? If not, how should the user handle them. Please advise. Thanks
    > for your help.
    >
    > Best Regards,
    >
    > Paul J. Lay
    >
    >
    >
    George Ter-Saakov, May 13, 2004
    #3
  4. Paul J. Lay

    Paul J. Lay Guest

    I believe I have it figured out using multipart requests. There is one post
    parameter per part. I understand that and it is working well. Now I have
    many non multipart POST requests from internet explorerer. That is just a
    simple message comtaining parm data pairs, i.e.
    parm1=data1&parm2=data2&parm3=data3.. I believe it is substring after the
    ? character on a get request. The browser only sends these data pairs in
    that mode. Suppose you want to send user data after the parm data. Is this
    possible? If so, what delimits the last parm data pair from the start of
    the user data? I am confused on this point. Any ideas?

    Best Regards,

    Paul J. Lay

    "George Ter-Saakov" <> wrote in message
    news:...
    > If you using POST method parameters are not attached to URL.
    > They only attached to URL when using GET
    > With WebClient you suppose to use method UploadData but i have never been
    > using it.
    >
    > I have always been using HttpWebRequest for that type of jobs. This class
    > seems to be more flexible.
    >
    > George.
    >
    >
    > "Paul J. Lay" <> wrote in message
    > news:...
    > > I am sending and receiving multipart messages using the WebClient

    > UploadData
    > > method Method=Post. Everything seems to work well except when the URL
    > > contains parameters. For example:
    > > http://www.someURL.com?parm1=data1&parm2=data2. I don't believe these
    > > paramters are transmitted as part of the URL with the HTTP Post

    interface.
    > I
    > > was under the impression that the WebClient class automatically handled
    > > these parameters for POST. The documentation doesn't cover this. Is

    this
    > > correct? If not, how should the user handle them. Please advise.

    Thanks
    > > for your help.
    > >
    > > Best Regards,
    > >
    > > Paul J. Lay
    > >
    > >
    > >

    >
    >
    Paul J. Lay, May 13, 2004
    #4
  5. Paul J. Lay

    Joerg Jooss Guest

    Paul J. Lay wrote:
    > I believe I have it figured out using multipart requests. There is
    > one post parameter per part. I understand that and it is working
    > well. Now I have many non multipart POST requests from internet
    > explorerer. That is just a simple message comtaining parm data
    > pairs, i.e. parm1=data1&parm2=data2&parm3=data3.. I believe it is
    > substring after the ? character on a get request. The browser only
    > sends these data pairs in that mode. Suppose you want to send user
    > data after the parm data. Is this possible? If so, what delimits
    > the last parm data pair from the start of the user data? I am
    > confused on this point. Any ideas?


    What you're describing is the MIME type application/x-www-form-urlencoded --
    that is used for "normal" web forms. No, there's no way to add more
    information other than the key/value pairs contained in the request body.
    Also note that it is perfectly legal to POST data to a URI that contains a
    query string, like

    POST /application/foo?bar=1 HTTP/1.1
    [Headers...]

    a=x&b=y

    The serverside should pick up all parameters, regardless of their true
    origin (form values, query string). Following up on the previous example,
    that means that serverside code should be able to retrieve
    a=x
    b=y
    bar=1


    Cheers,

    --
    Joerg Jooss
    Joerg Jooss, May 15, 2004
    #5
    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. Adnan Selimovic

    WebClient/POST/aspx file

    Adnan Selimovic, Jan 23, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    4,747
    Adnan Selimovic
    Jan 23, 2004
  2. Joerg Jooss
    Replies:
    0
    Views:
    1,120
    Joerg Jooss
    Apr 10, 2004
  3. bruce barker

    Re: WebClient POST

    bruce barker, Apr 19, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    574
    bruce barker
    Apr 19, 2004
  4. =?Utf-8?B?UmFzaWthIFdpamF5YXJhdG5l?=

    RE: WebClient POST

    =?Utf-8?B?UmFzaWthIFdpamF5YXJhdG5l?=, Apr 20, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    3,021
    =?Utf-8?B?UmFzaWthIFdpamF5YXJhdG5l?=
    Apr 20, 2004
  5. Paul J. Lay

    WebClient Class Method=Post

    Paul J. Lay, May 12, 2004, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    147
    Feroze [MSFT]
    May 24, 2004
Loading...

Share This Page