By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,361 Members | 1,677 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,361 IT Pros & Developers. It's quick & easy.

ASP.Net ways of streaming pdf / word docs?

P: n/a
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!
Mar 20 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On Mar 20, 10:53 am, "Jim Bancroft" <sdf...@jsdfk.comwrote:
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();

Mar 20 '07 #2

P: n/a
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();

Mar 20 '07 #3

P: n/a
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" <sd****@jsdfk.comwrote in message
news:e%****************@TK2MSFTNGP05.phx.gbl...
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!

Mar 21 '07 #4

P: n/a
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" <sd****@jsdfk.comwrote in message
news:e%****************@TK2MSFTNGP05.phx.gbl...
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!

Apr 9 '07 #5

P: n/a
"Pen Juan" <le***@hotmail.comwrote in message
news:32**********************************@microsof t.com...
Can you provide your excellent article in EasyUploads in C# too?
Why don't you just convert it...?
Apr 9 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.