Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 15th, 2008, 03:00 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Quote:
quote:Originally posted by LenexaKS
 Thanks Imar, works like a charm!
(BTW, dparsons said "big BUCK", not "big buckS". But good karma from saving an ignorant coder is its own reward.)

LMFAO. Oh how petty flames amuse me. Of course I don't see what a simple typo has to do with being ignorant but whatever.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
 
Old February 15th, 2008, 04:00 PM
Authorized User
 
Join Date: Sep 2006
Location: Lenexa, KS, USA.
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default

DParsons, I'm sorry, by "ignorant" I was talking about myself, as in you guys getting good karma in return for helping an ignorant person, me. And the first sentence was a joke about how you guys didn't get paid big bucks, maybe only big buck; I had assumed you weren't recompensed at all for helping. Sorry for the poor phrasing (and thanks again for the help).

 
Old February 15th, 2008, 04:12 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Ahh. My appologies for misunderstanding. No none of us are compenstated to post on the forums we all just do it for one reason or another. Glad Imar's solution worked out for you.

-Doug

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
 
Old February 15th, 2008, 04:31 PM
Authorized User
 
Join Date: Sep 2006
Location: Lenexa, KS, USA.
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No problem - tone & intent are notoriously hard to judge in posts.

 
Old February 15th, 2008, 07:03 PM
Authorized User
 
Join Date: Sep 2006
Location: Lenexa, KS, USA.
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default

One note for future searchers... Imar's code downloads the PDF file, but the PDF file isn't then openable. Changing the ContentType setting to "octet-stream" works great, ie:
    Response.ContentType = "application/octet-stream";
There are many easily googleable ContentTypes, including, I think, "application/pdf', but the above works fine.

OK, one MORE note in case future searchers haven't used MapPath before - that code assumes that the file is in the same folder as the application, so I had to instead supply the absolute (non-URL-format) folder name, eg, "D:\folder1\folder2\".


 
Old February 16th, 2008, 01:20 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

MapPath also works with folders, as long as the path is somewhere within the scope of your site. E.g.:

Server.MapPath("/SomeFolder/SomeFile.pdf")

would work as well.

If the file is not located within the site, then you need the physical path.

I think if you use application/pdf then the file is opened in the browser, not streamed.

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.




Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET Website with Pocket PC Dlls ashu_from_india .NET Framework 2.0 3 June 11th, 2008 11:06 AM
downloading image from website pandjie Java Basics 1 December 11th, 2006 10:39 PM
Downloading files via a browser gfrank1157 ASP.NET 2.0 Basics 3 June 14th, 2006 04:13 PM
linked table on user's pc Spaceman Spiff Access VBA 8 March 11th, 2004 02:51 PM
downloading files serge Classic ASP Professional 4 September 8th, 2003 10:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.