[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

setting timeout of a post in c#

Posted on 2009-02-10
3
Medium Priority
?
212 Views
Last Modified: 2013-12-17
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

0
Comment
Question by:rodmjay
2 Comments
 
LVL 8

Expert Comment

by:bedanand
ID: 23609108
On the web.config file you can change the timeout duration on seconds.


0
 
LVL 15

Accepted Solution

by:
Praveen Venu earned 2000 total points
ID: 23609229
client.Timeout = 60000; //(Required timeout milliseconds)
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Screencast - Getting to Know the Pipeline
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month17 days, 23 hours left to enroll

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question