Calling HttpWebRequest.GetResponse() hangs my program!

  • Thread starter Thread starter Mahernoz
  • Start date Start date
M

Mahernoz

Hi Friends,

I have this code in a C# console application which calls a URL on my
website(Asp.net/C#) with Querystrings. (I have also tried without
querystrings).

The problem is my program gets hanged. Even no error message is
displayed.

HttpWebRequest req =
(HttpWebRequest)WebRequest.Create(CaptureURLForScheduler +
strQueryString);
req.Method = "POST";

ASCIIEncoding encoding = new ASCIIEncoding();
byte[] byte1 = encoding.GetBytes(strQueryString);
req.ContentLength = byte1.Length;

//This line hangs my program
HttpWebResponse res = (HttpWebResponse)req.GetResponse();
//This line hangs my program

Can you tell me what's going on and how can i fix this?

Regards,
Mahernoz
 
See answer in the C# group. No need to cross-post, it just makes it harder
for people to know which is the active thread.
 
Peter Bromberg said:
See answer in the C# group. No need to cross-post, it just makes it harder
for people to know which is the active thread.

Did you mean multi-post? Cross posting is fine if it really is ambigous
which group a question ought to be posted.
 
Peter Bromberg said:
Right. No need to split hairs, I am sure the OP got the picture if he / she
posesses an above room-temperature IQ. :-)

Most people who multi-post have never heard the terms multi-post or
cross-post.

I therefore should have in fact been more explicit.

Multi-post: To post the same question to various groups as individuals
messages. Replies to these messages only appear in the group in which it
was found.

Cross-port: To post the same question to various groups by addressing a
single message to multiple groups. By default when replying a newsreader
will address the reply to all groups that the orignal message was posted to.
Hence the reply will be seen in all groups not just the one it was found in.
 
Back
Top