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

Response.ContentType = "Application/pdf"

P: n/a
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
Share this Question
Share on Google+
4 Replies


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

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

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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.