A
Agustin
Hi. In my application I'm using a thread to asynchronously downlad data
form the web. In the thread I create a Web conection and after download
I rise an event and finish. this is the code
public void Download()
{
WebRequest request = WebRequest.Create(this.Url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
reader.Close();
dataStream.Close();
response.Close();
DownloadCompleteEventArgs arg = new DownloadCompleteEventArgs();
arg.Content = responseFromServer;
arg.Url = this.Url;
DownloadComplete(this, arg);
}
The question is, If I want to stop the thread while it's working I just
call the Thread Abort() method? What about the objects created inside
the thread? I thought that may be I should've closed.
How can I check If there is some thread running?
Thank you
form the web. In the thread I create a Web conection and after download
I rise an event and finish. this is the code
public void Download()
{
WebRequest request = WebRequest.Create(this.Url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
reader.Close();
dataStream.Close();
response.Close();
DownloadCompleteEventArgs arg = new DownloadCompleteEventArgs();
arg.Content = responseFromServer;
arg.Url = this.Url;
DownloadComplete(this, arg);
}
The question is, If I want to stop the thread while it's working I just
call the Thread Abort() method? What about the objects created inside
the thread? I thought that may be I should've closed.
How can I check If there is some thread running?
Thank you