HttpWebRequest method POST

P

PawelR

Hello Group,

How send few value using HttpWebReguest with POST method in one request?

Thx.
PawelR
 
M

Martin Honnen

PawelR wrote:

How send few value using HttpWebReguest with POST method in one request?

What kind of "values", what kind of Content-Type should the request body
have?

If you simply want to POST some name=value pairs as
application/x-www-form-urlencoded contents then it might be easier to
use WebClient and its UploadValues method:
<http://msdn.microsoft.com/library/d...fSystemNetWebClientClassUploadValuesTopic.asp>

If you want to do that with HttpWebRequest then get hold of the request
stream, construct the request body (i.e. name=value pairs encoded as
application/x-www-form-urlencoded) and write it to the request stream.
To urlencode the name and values you can use UrlEncode method of
HttpUtitity.
 
P

PawelR

Thanks,
I ought to send to server few pairs: name1=value1, name2=value2,
name3=value3 and I must use http post because server working only with http
post method.
Pawel
 
J

Joerg Jooss

PawelR said:
Thanks,
I ought to send to server few pairs: name1=value1, name2=value2,
name3=value3 and I must use http post because server working only
with http post method. Pawel

That's what WebClient.UploadValues() will do.

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

runtime change in web.config 2
joystick programming 2
Fill treeView from DataTable 2
Set application version 2
convert to array of byte 3
Binding int to textBox 2
WMI for Win98SE 1
Send fax. 2

Top