Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / August 2006

Tip: Looking for answers? Try searching our database.

File from database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David Thielen - 12 May 2006 00:37 GMT
Hi;

I have a file stored in my database as a blob. I would like to have a url to
the file like http://www.myportal.com/files/FileName.pdf so that if the user
then goes to save the file locally, it has the name FileName.pdf (where I
have the actual name of the file).

Is there a way to do this?

Signature

thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Walter Wang [MSFT] - 12 May 2006 04:38 GMT
Hi Dave,

Thank you for posting!

From your description, I assume you're trying to download files from
asp.net website. Please feel free to correct me if there's anything I
missed.

Here's a kb article:
HOW TO: Read and Write BLOB Data by Using ADO.NET Through ASP.NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;326502

In your case, you may use following code snippets to set the file name:

Response.AddHeader("Content-Disposition",
"attachment;filename=FileName.pdf")
Response.ContentType = "application/pdf"

By the way, for asp.net related issues, I would suggest posting in the
newsgroup below:

microsoft.public.dotnet.framework.aspnet

The reason why we recommend posting appropriately is you will get the most
qualified pool of respondents, and other partners who the newsgroups
regularly can either share their knowledge or learn from your interaction
with us. Thank you for your understanding.

Regards,

Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Ben Voigt - 12 May 2006 19:27 GMT
> Hi Dave,
>
[quoted text clipped - 13 lines]
> "attachment;filename=FileName.pdf")
> Response.ContentType = "application/pdf"

If you want the user to be prompted to save the file and not open Acrobat
inside the browser, use "application/octet-stream" instead.

> By the way, for asp.net related issues, I would suggest posting in the
> newsgroup below:
[quoted text clipped - 18 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
Walter Wang [MSFT] - 15 May 2006 01:36 GMT
Thank you Ben for pointing out.

Have a nice day.

Regards,

Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
David Thielen - 15 May 2006 18:28 GMT
thank you both of you. filename=FileName.pdf was the magic I needed to know.

Signature

thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

> Hi Dave,
>
[quoted text clipped - 35 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
Greg Young - 29 May 2006 18:48 GMT
In order to do that you are going to need to rewrite the URL.

if you google on ASP.NET rewrite URL you should get quite a few results :)

The basic process is to create a httpmodule (or httphandler) that internally
redirects the URL.

Cheers,

Greg Young
> thank you both of you. filename=FileName.pdf was the magic I needed to
> know.
[quoted text clipped - 40 lines]
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
Vijay - 03 Aug 2006 21:59 GMT
If you want the user to be prompted to save the file and not open Acrobat
inside the browser, use Response.WriteFile followed by Response.End

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.