J
Jeff T
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();