Dear Jon. I'm not using response in my connection. Here is the entire
backgroundworker code:
string url = String.Concat(this.url);
long fileSize = file.Length;
WebRequest req = WebRequest.Create(url);
req.Method = "POST";
//Headers
req.ContentType = "multipart/form-data";
req.ContentLength = fileSize;
req.Headers.Add("Name",file.Name);
req.Headers.Add("Path", path);
req.Headers.Add("SessionID", session);
Stream stream = req.GetRequestStream();
using (BinaryWriter writer = new BinaryWriter(stream))
{
FileStream fs = new FileStream(file.FullName,
FileMode.Open);
using (BinaryReader reader = new BinaryReader(fs))
{
int i = 0;
long total = 0;
byte[] buffer = new byte[32768];
while (((i = reader.Read(buffer,
0,buffer.Length)) > 0) && !Stop)
{
writer.Write(buffer,0,i);
total += i;
uploadWorker.ReportProgress((int)(total *
100 / fileSize));
}
}
}
>
> Where you fetch the response, put it in a "using" statement and chances
> are it'll all start working with no issues.
>
> --
> Jon Skeet - <sk...@pobox.com>
> Web site:http://www.pobox.com/~skeet*
> Blog:http://www.msmvps.com/jon_skeet
> C# in Depth:http://csharpindepth.com