• 0

Close HttpWebRequest in C#


Question

Hi,

I am trying to close an HttpWebRequest I requested.

However, Close() could take a very long time to return.

Does anyone know why and how to solve this?

Is there a way I can set a timeout on the Close()?

Here's the code:

HttpWebRequest req

= (HttpWebRequest)WebRequest.Create(pageAddress);

req.Timeout=1000;

HttpWebResponse resp = (HttpWebResponse)req.GetResponse();

.

.

.

resp.Close();

thanks a lot!

:)

Link to comment
https://www.neowin.net/forum/topic/160833-close-httpwebrequest-in-c/
Share on other sites

6 answers to this question

Recommended Posts

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.