D
Dunc
Hi,
I've got an HttpWebResponse object, all working fine. I'm getting the
underlying stream and currently writing it to a file using the ReadToEnd()
method. All happy.
I want to do a bit of manipulation before writing this to the disk; can
anyone point me in the right direction of how to copy it to a byte array so
I can make my mods before writing it to the disk?
Thanks in advance,
Dunc
---/ snip /---
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(strRemoteURI);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
// Get the stream associated with the response.
Stream receiveStream = response.GetResponseStream();
// Pipes the stream to a higher level stream reader with the required
encoding format.
StreamReader readStream = new StreamReader (receiveStream,
System.Text.Encoding.Unicode);
StreamWriter writeStream = new StreamWriter("_" + strFileName, false,
System.Text.Encoding.Unicode);
writeStream.Write(readStream.ReadToEnd());
writeStream.Flush();
response.Close();
readStream.Close();
writeStream.Close();
I've got an HttpWebResponse object, all working fine. I'm getting the
underlying stream and currently writing it to a file using the ReadToEnd()
method. All happy.
I want to do a bit of manipulation before writing this to the disk; can
anyone point me in the right direction of how to copy it to a byte array so
I can make my mods before writing it to the disk?
Thanks in advance,
Dunc
---/ snip /---
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(strRemoteURI);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
// Get the stream associated with the response.
Stream receiveStream = response.GetResponseStream();
// Pipes the stream to a higher level stream reader with the required
encoding format.
StreamReader readStream = new StreamReader (receiveStream,
System.Text.Encoding.Unicode);
StreamWriter writeStream = new StreamWriter("_" + strFileName, false,
System.Text.Encoding.Unicode);
writeStream.Write(readStream.ReadToEnd());
writeStream.Flush();
response.Close();
readStream.Close();
writeStream.Close();