WebClient Class Method=Post

P

Paul J. Lay

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
 
A

avnrao

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.
 
G

George Ter-Saakov

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.
 
P

Paul J. Lay

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
 
J

Joerg Jooss

Paul said:
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,
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top