Marc

Marc

  • NA
  • 2
  • 6.3k

Code to Stream PDF/Text File from URL

May 5 2006 10:01 AM
Thanks in advance everyone, I am a complete neophyte to progamming, but am getting better so please excuse my simplistic verbage. I have an applicaiton that uses a proprietary database. I can pass in a query via a URL over a dedicated port. The url would look like this: http://servername:16200/?indexname=value&indexname=value&doc_type=pdf The return stream from this URL encoded query will be either a pipe delimited .txt file if there are multiple hits, or a PDF or TIF stream if there is only one hit. There is no actual file specified, the "file" is written to disk on the database server, and there is a "listener" that handles the requests and streams back the temp file created on the database server. The problem I am having is how to write a page in C# or ASP.NET that will issue the query, and then determine the content type of the return so that it will either just display the PDF/TIFF (I can do this obviously), or if the return is the pipe delimited text to write that out to the screen (I can do the response.write part no problem). I am assuming I'll need some intermediate page to stream the result to memory or an array or something so I can then handle in on the "main" or "display" page. I've looked at ADODB.Stream and System.IO.Memorystream as possible ways to handle to return but am a little lost. Any direction or code samples would be GREATLY apprecaited. Thanks, Marc

Answers (1)