Hi ,
I m using window application for sending request to the web application(website) via HTTP post method while the web application needs to send an acknowledgment to the window application by sending some file as an attachment(file can be in any format)
I m using Response.TransmitFile(filename) to transfer the file from web to windows application but i m unable to see the file at windows side in the response object;
At windows application side i m using
Stream responseStream = responce.GetResponseStream();
StreamReader readerStream = new StreamReader(responseStream,Encoding.Unicode );
My query is how to confirm that the file is being transferred and how to save the file from the response object .
Pravara PatilPosted Mar 19, 2009, 6:05 AM
Hi,
I have created the file and I m sending this file using the Response.BinaryWrite (getContent)( Where getContent is the byte array having the file which I need to send) vis HTTP post method only. Also I m adding a Header and Content-Type as application/octet-stream in the Response.
Now while reading the (httpWebResponse) response in the stream at client side all the things (header + content-type + file + some extra bytes) are getting added. so when I try to read the file from stream it cannot be loaded since the content has chnged
Is there any way to separate the file from rest contents present in the response object.
Vishnu BPosted Mar 16, 2009, 1:35 PM
I think you need to create a file (hope you know the type of file you are downloading) using FileStream class and save that file in a specific path of your choice with the stream of bytes received from the response.GetResponseStream()