I've to send some post to a server, so i create a webrequest set the method, the content type and the content lenght. It works ok. Now I want to send a sec开发者_如何学运维ond post so I need to change the contentlenght but I give an exception and i don't understand why.
You haven't told us the error details, but I suspect the first request has not yet completed. IMO, unless you are doing something particularly subtle, it is often a good idea to use WebClient
, which is a wrapper around WebRequest
(etc) that greatly simplifies the API - for example you can just call the UploadData
method, or DownloadString
, etc. These are easy to call successively.
精彩评论