473,396 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Response.ContentType = "Application/pdf"

With ASP.NET 2.0
I'm trying to display the pdf file directly in the client browser, but I
only get a download dialogue box. Downloading the file works fine, but I
want to view the PDF directly.

I get the same response with:

Response.ContentType="Application/X-unknown" which is more understandable.

The Response.ContentType="Application/pdf" doesn't seem to tell the browser
that this actually is a PDF-file.

Mybe there is only a mistyping, but I shuld like a complete list of the
options for ContentType, like what phrase to use for all kind of files.
Anyone that knows where to find this?

(I have searched through help without finding a listing of all the filetypes
available)

Bjorn
May 29 '07 #1
4 61712
Bjorn,
You won't find a listing of possible contenttypes because there is
no set list. The content type just sets the MIME type for an element. MIME
types are constantly being expanded upon as new file formats are being
developed.

You can google for them. There's a table with a number of major MIME
types at:
http://www.utoronto.ca/webdocs/HTMLd.../mimetype.html

Application/pdf should work. The Application/X-unknown is the one
that developers use to force the browser to download the file. It could also
be an issue where your browser is not associating the pdf file with the
viewer correctly.
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
"Bjorn Sagbakken" <bj*****@online.nowrote in message
news:xY*********************@telenor.com...
With ASP.NET 2.0
I'm trying to display the pdf file directly in the client browser, but I
only get a download dialogue box. Downloading the file works fine, but I
want to view the PDF directly.

I get the same response with:

Response.ContentType="Application/X-unknown" which is more understandable.

The Response.ContentType="Application/pdf" doesn't seem to tell the
browser that this actually is a PDF-file.

Mybe there is only a mistyping, but I shuld like a complete list of the
options for ContentType, like what phrase to use for all kind of files.
Anyone that knows where to find this?

(I have searched through help without finding a listing of all the
filetypes available)

Bjorn

May 29 '07 #2
Try adding this line:
Response.AddHeader("Content-Disposition", "inline;filename="Filename.pdf");

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
"Bjorn Sagbakken" <bj*****@online.nowrote in message
news:xY*********************@telenor.com...
With ASP.NET 2.0
I'm trying to display the pdf file directly in the client browser, but I
only get a download dialogue box. Downloading the file works fine, but I
want to view the PDF directly.

I get the same response with:

Response.ContentType="Application/X-unknown" which is more understandable.

The Response.ContentType="Application/pdf" doesn't seem to tell the
browser that this actually is a PDF-file.

Mybe there is only a mistyping, but I shuld like a complete list of the
options for ContentType, like what phrase to use for all kind of files.
Anyone that knows where to find this?

(I have searched through help without finding a listing of all the
filetypes available)

Bjorn
May 29 '07 #3
Response.AddHeader("Content-Disposition", "inline;filename="Filename.pdf")
This result in a blank screen. Right-clicking on the form to view source for
curiosity show this message:
"The XML source file is unavailable for viewing" --But I have not added
anything XML-like to my form.
Note, I retrieve the pdf from a SQL server, using
"Response.BinaryWrite(FileByte)" as output.

Response.AddHeader("Content-Disposition",
"attachment;filename="Filename.pdf")
This causes the download box to appear. Ok for the moment, but not as
intended.

I just don't know why this happens. Maybe something in the @ page area or in
the html-header of the file?
Or in the settings of the browser?

Bjorn

"Steve C. Orr [MCSD, MVP, CSM, ASP Insider]" <St***@Orr.netwrote in
message news:BF**********************************@microsof t.com...
Try adding this line:
Response.AddHeader("Content-Disposition",
"inline;filename="Filename.pdf");

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
"Bjorn Sagbakken" <bj*****@online.nowrote in message
news:xY*********************@telenor.com...
>With ASP.NET 2.0
I'm trying to display the pdf file directly in the client browser, but I
only get a download dialogue box. Downloading the file works fine, but I
want to view the PDF directly.

I get the same response with:

Response.ContentType="Application/X-unknown" which is more
understandable.

The Response.ContentType="Application/pdf" doesn't seem to tell the
browser that this actually is a PDF-file.

Mybe there is only a mistyping, but I shuld like a complete list of the
options for ContentType, like what phrase to use for all kind of files.
Anyone that knows where to find this?

(I have searched through help without finding a listing of all the
filetypes available)

Bjorn

May 30 '07 #4
Thanks,

Your link was just what I was looking for.

Bjorn
"Mark Fitzpatrick" <ma******@fitzme.comwrote in message
news:uU**************@TK2MSFTNGP03.phx.gbl...
Bjorn,
You won't find a listing of possible contenttypes because there is
no set list. The content type just sets the MIME type for an element. MIME
types are constantly being expanded upon as new file formats are being
developed.

You can google for them. There's a table with a number of major
MIME types at:
http://www.utoronto.ca/webdocs/HTMLd.../mimetype.html

Application/pdf should work. The Application/X-unknown is the one
that developers use to force the browser to download the file. It could
also be an issue where your browser is not associating the pdf file with
the viewer correctly.
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
"Bjorn Sagbakken" <bj*****@online.nowrote in message
news:xY*********************@telenor.com...
>With ASP.NET 2.0
I'm trying to display the pdf file directly in the client browser, but I
only get a download dialogue box. Downloading the file works fine, but I
want to view the PDF directly.

I get the same response with:

Response.ContentType="Application/X-unknown" which is more
understandable.

The Response.ContentType="Application/pdf" doesn't seem to tell the
browser that this actually is a PDF-file.

Mybe there is only a mistyping, but I shuld like a complete list of the
options for ContentType, like what phrase to use for all kind of files.
Anyone that knows where to find this?

(I have searched through help without finding a listing of all the
filetypes available)

Bjorn


May 30 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: gregory_may | last post by:
I have an application I created called "JpegViewer.exe". It simply loads a Jpeg file and displays in on the screen. It works great, in my lab. When I am using it at a customer site, things...
2
by: dave | last post by:
Hello Can any one suggest me how to create pdf on the fly... I had already checked link http://www.aspfaq.com/show.asp?id=2207 but I cannot use third party component as site is not hosted some...
5
by: TJS | last post by:
trying to display pdf file in browser fails on this line: Response.ContentType = "application/pdf" getting an error about no declaration found for "response" what declaration is needed ???
5
by: David Lozzi | last post by:
Hello, this is a repost of a previous post of mine from today. I need to export multiple documents (doc, xls, ppt, jpg) and crystal reports to a single PDF file. I know how to export a single...
0
by: ASP Developer | last post by:
For some reason when I direct my users to a word document via Response.ContentType = "application/word" the spell check is turned off. Does anyone know which smart tag needs to be mofied to have it...
0
by: Phil | last post by:
I am writing an application (using Visual Studio 2003) that consumes a third party Web Service, but I receive the following error : Client found response content type of 'application/xml;...
43
by: Christoph Schneegans | last post by:
Hi! Okay, so positions on "text/html" XHTML are totally contradicting. Anyway! I hope there's more consensus about "application/xml" XHTML. I've recently learned that Opera 9.0b2 does not only...
1
by: rguarnieri | last post by:
Hi!, I'm using Visual Studio 6.0 and I'm trying to open an asp page like a .pdf file, I used Response.ContentType="application/pdf" in my asp page but it doesn't work This is an example: <%@...
4
by: Dave | last post by:
I have a global.asax file with Application_Start defined and create some static data there and in another module used in the asp.net application and I realize that static data is shared amongst...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.