 |
| 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
|
|
|
|

February 15th, 2008, 03:00 PM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
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
================================================== =========
|
|

February 15th, 2008, 04:00 PM
|
|
Authorized User
|
|
Join Date: Sep 2006
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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).
|
|

February 15th, 2008, 04:12 PM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
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
================================================== =========
|
|

February 15th, 2008, 04:31 PM
|
|
Authorized User
|
|
Join Date: Sep 2006
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
No problem - tone & intent are notoriously hard to judge in posts.
|
|

February 15th, 2008, 07:03 PM
|
|
Authorized User
|
|
Join Date: Sep 2006
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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\".
|
|

February 16th, 2008, 01:20 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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.
|
|
 |