Using thread in aspx-page making a webrequest

Posted by Mike Ribeiro on Stack Overflow See other posts from Stack Overflow or by Mike Ribeiro
Published on 2010-06-17T14:28:31Z Indexed on 2010/06/17 14:33 UTC
Read the original article Hit count: 229

Filed under:
|
|

Hi,

I kind of new to the hole threading stuff so bare with me here..

I have a aspx-page that takes some input and makes a reqest:

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(string.Format("{0}?{1}", strPostPath, strPostData));
  request.Method = "GET";
  request.Timeout = 5000; // set 5 sec. timeout
  request.ProtocolVersion = HttpVersion.Version11;

   try
   {
       HttpWebResponse response = (HttpWebResponse)request.GetResponse();
       /do some with response       
   }
   catch (WebException exce)
   {

       //Log some stuff
   }

The thing is that this function is used ALOT.

Is there any advantage to make every request in a separate thread and exactly how would that look like?

Thx!

© Stack Overflow or respective owner

Related posts about c#

Related posts about threading