Combining the streams:Web application

Posted by Surendra J on Stack Overflow See other posts from Stack Overflow or by Surendra J
Published on 2011-03-03T07:15:22Z Indexed on 2011/03/03 7:25 UTC
Read the original article Hit count: 405

Filed under:
|
|
|
|

This question deals mainly with streams in web application in .net. In my webapplication I will display as follows:

  1. bottle.doc
  2. sheet.xls
  3. presentation.ppt
  4. 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.

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET