View Non-Microsoft File Via ASP ?

  • In SQL Server I have a text field that contains a post script file. I want to be able to retrieve and display this file via a web page. My ideal solution would be that the user clicks on a link that provides a UniqueID that then can be used to query SQL Server and return the file.

    The actual program executable that I have to open postscript files is called GhostView. I found a sample of code that will work for images or MS application files, but I don't know how to get it to work for the GhostView executable. Can anyone tell me how to accomplish this ?

    Here is the sample code:

    <%

    'Set the content type to the specific type that you are sending.

    'Response.ContentType = "application/x-msexcel"

    'Response.ContentType = "application/msword"

    'Response.ContentType = "image/jpeg"

    Const adTypeBinary = 1

    Dim strFilePath

    strFilePath = "C:\tmp\CMReportFile.ps" 'This is the path to the file on disk.

    Set objStream = Server.CreateObject("ADODB.Stream")

    objStream.Open

    objStream.Type = adTypeBinary

    objStream.LoadFromFile strFilePath

    Response.BinaryWrite objStream.Read

    objStream.Close

    Set objStream = Nothing

    %>

    Thank you.

  • Little off the path for us. I'd recommend trying an ASP specific site, or even maybe the company that wrote the GhostView app.

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

  • Two things come to mind that you're going to need to find out:

    (1) You're going to need to know the content type which will match GhostView. Another place to ask is possibly a Unix site since GhostView is a popular tool for Unix.

    (2) You're going to need to have GhostView set to fire on the client side when the .ps comes across. For instance, QA can fire for a .sql file, but you have to set it to do so.

    However, if you already have it on disk, is there an issue with using a virtual directory and doing a response.redirect (although this requires another roundtrip between client and server)?

    K. Brian Kelley

    http://www.truthsolutions.com/

    Author: Start to Finish Guide to SQL Server Performance Monitoring

    http://www.netimpress.com/shop/product.asp?ProductID=NI-SQL1

    K. Brian Kelley
    @kbriankelley

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply