Link to home
Start Free TrialLog in
Avatar of rodmjay
rodmjayFlag for United States of America

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);
 
        }

Open in new window

Avatar of bedanand
bedanand
Flag of Nepal image

On the web.config file you can change the timeout duration on seconds.


ASKER CERTIFIED SOLUTION
Avatar of Praveen Venu
Praveen Venu
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial