ASP.Net ways of streaming pdf / word docs?

Discussion in 'ASP .Net' started by Jeff T, Mar 20, 2007.

  1. Jeff T

    Jeff T Guest

    On Mar 20, 10:53 am, "Jim Bancroft" <> wrote:
    > Hi everyone,
    >
    > We've have files we'd like to store in a SQL Server blob or text column and
    > make available online for our clients. Instead of linking to a document
    > sitting on a file server, we figure it'll be easier to manage the document
    > store this way.
    >
    > Could someone point me to a tutorial or online docs on what classes .Net
    > provides for streaming bytes (I assume that's what I'll be doing) from a
    > database to a web browser and vice versa? Document upload will be the next
    > step in the process.
    >
    > I'm guessing part of this will involve setting the http response headers.
    > The best thing would be a pre-existing tutorial but any help is appreciated.
    > Thanks!


    Sounds like all you need to do is grab the binary data from the
    database based on some sort of input and then send it to the browser.
    You have the option to have the browser prompt the user to open/save
    or just to have the browser open the document if it can within it's
    window. (for example, IE can display Word docs).

    So here is some sample C# code to send a file to the browser and have
    it prompt the user to open/save it.

    Response.ContentType = "application/excel";
    Response.AddHeader("Content-Disposition", "attachment;
    filename=" + nameFromTheDB);
    Response.BinaryWrite(binaryDataFromTheDB);
    Response.End();
     
    Jeff T, Mar 20, 2007
    #1
    1. Advertising

  2. Jeff T

    Jim Bancroft Guest

    Hi everyone,

    We've have files we'd like to store in a SQL Server blob or text column and
    make available online for our clients. Instead of linking to a document
    sitting on a file server, we figure it'll be easier to manage the document
    store this way.

    Could someone point me to a tutorial or online docs on what classes .Net
    provides for streaming bytes (I assume that's what I'll be doing) from a
    database to a web browser and vice versa? Document upload will be the next
    step in the process.

    I'm guessing part of this will involve setting the http response headers.
    The best thing would be a pre-existing tutorial but any help is appreciated.
    Thanks!
     
    Jim Bancroft, Mar 20, 2007
    #2
    1. Advertising

  3. Jeff T

    Jim Bancroft Guest

    Looks great. Thanks!

    > So here is some sample C# code to send a file to the browser and have
    > it prompt the user to open/save it.
    >
    > Response.ContentType = "application/excel";
    > Response.AddHeader("Content-Disposition", "attachment;
    > filename=" + nameFromTheDB);
    > Response.BinaryWrite(binaryDataFromTheDB);
    > Response.End();
    >
     
    Jim Bancroft, Mar 20, 2007
    #3
  4. Yes, this article explains how to upload binary files into your SQL Server
    database and how to stream them back out again. And yes it does cover byte
    streaming.

    http://SteveOrr.net/articles/EasyUploads.aspx

    --
    I hope this helps,
    Steve C. Orr,
    MCSD, MVP, CSM, ASPInsider
    http://SteveOrr.net


    "Jim Bancroft" <> wrote in message
    news:e%...
    > Hi everyone,
    >
    > We've have files we'd like to store in a SQL Server blob or text column
    > and make available online for our clients. Instead of linking to a
    > document sitting on a file server, we figure it'll be easier to manage the
    > document store this way.
    >
    > Could someone point me to a tutorial or online docs on what classes .Net
    > provides for streaming bytes (I assume that's what I'll be doing) from a
    > database to a web browser and vice versa? Document upload will be the
    > next step in the process.
    >
    > I'm guessing part of this will involve setting the http response headers.
    > The best thing would be a pre-existing tutorial but any help is
    > appreciated. Thanks!
    >
    >
     
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider], Mar 21, 2007
    #4
  5. Steve,
    Can you provide your excellent article in EasyUploads in C# too?
    Thank you.
    --
    Pen


    "Steve C. Orr [MCSD, MVP, CSM, ASP Inside" wrote:

    > Yes, this article explains how to upload binary files into your SQL Server
    > database and how to stream them back out again. And yes it does cover byte
    > streaming.
    >
    > http://SteveOrr.net/articles/EasyUploads.aspx
    >
    > --
    > I hope this helps,
    > Steve C. Orr,
    > MCSD, MVP, CSM, ASPInsider
    > http://SteveOrr.net
    >
    >
    > "Jim Bancroft" <> wrote in message
    > news:e%...
    > > Hi everyone,
    > >
    > > We've have files we'd like to store in a SQL Server blob or text column
    > > and make available online for our clients. Instead of linking to a
    > > document sitting on a file server, we figure it'll be easier to manage the
    > > document store this way.
    > >
    > > Could someone point me to a tutorial or online docs on what classes .Net
    > > provides for streaming bytes (I assume that's what I'll be doing) from a
    > > database to a web browser and vice versa? Document upload will be the
    > > next step in the process.
    > >
    > > I'm guessing part of this will involve setting the http response headers.
    > > The best thing would be a pre-existing tutorial but any help is
    > > appreciated. Thanks!
    > >
    > >

    >
    >
     
    =?Utf-8?B?UGVuIEp1YW4=?=, Apr 9, 2007
    #5
  6. Jeff T

    Mark Rae Guest

    "Pen Juan" <> wrote in message
    news:...

    > Can you provide your excellent article in EasyUploads in C# too?


    Why don't you just convert it...?
     
    Mark Rae, Apr 9, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sharon
    Replies:
    0
    Views:
    609
    Sharon
    Jul 27, 2005
  2. KYG
    Replies:
    2
    Views:
    902
    Ian Collins
    Aug 18, 2008
  3. Drew

    Converting Word docs to PDF

    Drew, Dec 27, 2004, in forum: ASP General
    Replies:
    4
    Views:
    186
  4. Stéphane Wirtel
    Replies:
    0
    Views:
    191
    Stéphane Wirtel
    Apr 19, 2007
  5. Al
    Replies:
    1
    Views:
    157
    Henry Law
    Oct 16, 2005
Loading...

Share This Page