rodmjay
asked on
setting timeout of a post in c#
Im trying to specify a timeout length of the following code. Like if it takes more than 7 seconds, then stop processing or something, and throw a TimeoutException or something. Does anybody know how to do that?
public string ProcessHttpPost(string url)
{
WriteValuesToTrace();
WebClient client = new WebClient();
byte[] bResponse = client.UploadValues(url, "POST", this.Values);
return Encoding.ASCII.GetString(bResponse);
}
On the web.config file you can change the timeout duration on seconds.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.