F
Fredrik
How can I download a binary file (like .doc or .pdf) from http to my
harddrive using the .net framework?
WebRequest objRequest = System.Net.HttpWebRequest.Create(url);
objResponse = objRequest.GetResponse();
BinaryReader bsRead = new BinaryReader(objResponse.GetResponseStream()
FileStream fs = new FileStream("test.doc", FileMode.CreateNew);
while(bsRead.PeekChar() != -1)
{
cbuf=bsRead.ReadByte();
fs.WriteByte(cbuf);
}
is one of the method I've tried. All of them failed becuase seeing in
the base stream wasn't supported. All tutorals and examples i've seen,
both on the internet and in msdn, deals with reading text, or a binary
file of predefined size.
Downloading a .doc file using Webclient.DownloadFile(...) resulted in
a file that seemed to have been treated like text, not binary.
Please help!
harddrive using the .net framework?
WebRequest objRequest = System.Net.HttpWebRequest.Create(url);
objResponse = objRequest.GetResponse();
BinaryReader bsRead = new BinaryReader(objResponse.GetResponseStream()
FileStream fs = new FileStream("test.doc", FileMode.CreateNew);
while(bsRead.PeekChar() != -1)
{
cbuf=bsRead.ReadByte();
fs.WriteByte(cbuf);
}
is one of the method I've tried. All of them failed becuase seeing in
the base stream wasn't supported. All tutorals and examples i've seen,
both on the internet and in msdn, deals with reading text, or a binary
file of predefined size.
Downloading a .doc file using Webclient.DownloadFile(...) resulted in
a file that seemed to have been treated like text, not binary.
Please help!