Hi,
I am using the above object to different POST and GET request. Basically I am downloading a file. I want to download about 10 different files.
However I want to be able to close the connetion which I know is staying open even when i do this.
[code=cpp]
WebProxy proxy = new WebProxy(m_prox yServer, 8080);
//We do a GET to retrieve the ASP Session ID, and Viewstate and Event attributes states which is set in the reponse
WebRequest objRequestGet = HttpWebRequest. Create(m_URL);
objRequestGet.P roxy = proxy;
((HttpWebReques t)objRequestGet ).UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)";
objRequestGet.M ethod = "GET";
WebHeaderCollec tion headers = null;
using (HttpWebRespons e objResponseGet = (HttpWebRespons e)objRequestGet .GetResponse())
{
headers = objResponseGet. Headers;
StreamReader reader = new StreamReader(ob jResponseGet.Ge tResponseStream ());
html = reader.ReadToEn d();
objResponseGet. Close();
reader.Close();
}
[/code]
How do i close the connection?
I am using the above object to different POST and GET request. Basically I am downloading a file. I want to download about 10 different files.
However I want to be able to close the connetion which I know is staying open even when i do this.
[code=cpp]
WebProxy proxy = new WebProxy(m_prox yServer, 8080);
//We do a GET to retrieve the ASP Session ID, and Viewstate and Event attributes states which is set in the reponse
WebRequest objRequestGet = HttpWebRequest. Create(m_URL);
objRequestGet.P roxy = proxy;
((HttpWebReques t)objRequestGet ).UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)";
objRequestGet.M ethod = "GET";
WebHeaderCollec tion headers = null;
using (HttpWebRespons e objResponseGet = (HttpWebRespons e)objRequestGet .GetResponse())
{
headers = objResponseGet. Headers;
StreamReader reader = new StreamReader(ob jResponseGet.Ge tResponseStream ());
html = reader.ReadToEn d();
objResponseGet. Close();
reader.Close();
}
[/code]
How do i close the connection?
Comment