Combining the streams:Web application
- by Surendra J
This question deals mainly with streams in web application in .net. In my webapplication I will display as follows:
bottle.doc
sheet.xls
presentation.ppt
stackof.jpg
Button
I will keep checkbox for each one to select. Suppose a user selected the four files and clicked the button,which I kept under. Then I instantiate clasees for each type of file to convert into pdf, which I wrote already and converted them into pdf and return them. My problem is the clases is able to read the data form URL and convert them into pdf. But I don't know how to return the streams and merge them.
string url = @"url";
//Prepare the web page we will be asking for
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
request.ContentType = "application/mspowerpoint";
request.UserAgent = "Mozilla/4.0+(compatible;+MSIE+5.01;+Windows+NT+5.0";
//Execute the request
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
//We will read data via the response stream
Stream resStream = response.GetResponseStream();
//Write content into the MemoryStream
BinaryReader resReader = new BinaryReader(resStream);
MemoryStream PresentaionStream = new MemoryStream(resReader.ReadBytes((int)response.ContentLength));
//convert the presention stream into pdf and save it to local disk.
But I would like to return the stream again. How can I achieve this any Ideas are welcome.