ASPX files download when trying to view PDF files

Discussion about official Mozilla Firefox builds
Locked
User avatar
Argelius
Posts: 88
Joined: June 21st, 2005, 5:16 am

ASPX files download when trying to view PDF files

Post by Argelius »

I frequent a web site which I view/download pdf documents. I've recently switched over to Firefox (from Chrome) and now have a problem with this site.

In Chrome, when I click on the pdf icon to view/download the pdf, it opened and was viewable in a new tab.

In FF (4.0b7) I get popup asking me what I'd like to do with a .aspx file (save or open with...). I've tried associating the file type with Preview and Firefox, but in both instances, all I get is a small .aspx file downloaded and no pdf.

I've searched through the forums and found other references to this, but couldn't locate a solution.

Any ideas?

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b7) Gecko/20100101 Firefox/4.0b7 ID:20101104131842
User avatar
RobertJ
Moderator
Posts: 10880
Joined: October 15th, 2003, 7:40 pm
Location: Chicago IL/Oconomowoc WI

Re: ASPX files download when trying to view PDF files

Post by RobertJ »

This is likely do to the Content_Type being set incorrectly by the site. How a file is processed by a browser is determined by the Content-Type field in the http Response Header; the file suffix should be ignored when there is a Content-Type field. FF adheres to this rigorously.

NOTE: Some browsers guess at the content based on the file suffix even when a Content-Type is specified. This is a security issue.

If you could provide a link I can take a look.

.
FF 92.0 - TB 78.13 - Mac OSX 10.13.6
User avatar
Argelius
Posts: 88
Joined: June 21st, 2005, 5:16 am

Re: ASPX files download when trying to view PDF files

Post by Argelius »

RobertJ -- thanks for your help.
Unfortunately, it's a secure site with patient information in the pdfs (I'm a doctor), so I can't provide the link.
Work case scenario, I continue to use Chrome for this one site, so not a deal breaker. But I'm a gadget-nut, tinkerer, so I see this as a challenge to fix...
Mordwin
Posts: 653
Joined: June 8th, 2005, 6:10 am

Re: ASPX files download when trying to view PDF files

Post by Mordwin »

That's a site issue, normally you'd serve aspx files as HTML as that's the normal output from the server when processing an aspx file, so this would be the default behaviour on the web server. If the aspx file is going to be actually serving something else, it should use the ContentType property of the Response object to set the correct MIME type (application/pdf in this case) to override the default.

This is an issue for the site's admin, so you'd best contact them to see if they can fix it.
User avatar
RobertJ
Moderator
Posts: 10880
Joined: October 15th, 2003, 7:40 pm
Location: Chicago IL/Oconomowoc WI

Re: ASPX files download when trying to view PDF files

Post by RobertJ »

When you try to download a pdf and get the ASPX instead, before you do anything hit command + I on your keyboard. A window should open. Look under the General tab at a list called Meta. Under Content-Type you should see

Type: application/pdf

If instead you see

Type: text/html

The server is mis-configured. Since FF adheres strictly to the Internet Engineering Task Force (IETF) in RFC2616 (Hypertext Transfer Protocol -- HTTP/1.1), Section 7.2.1 Type, which states:

Any HTTP/1.1 message containing an entity-body SHOULD include a Content-Type header field defining the media type of that body. If and only if the media type is not given by a Content-Type field, the recipient MAY attempt to guess the media type via inspection of its content and/or the name extension(s) of the URI used to identify the resource.


In other words, how a file is processed by a browser should be determined by the Content-Type field in the http Response Header; the file suffix should be ignored when there is a Content-Type field.The Content-Type should be application/pdf not text/html

This is often an issue when the folks responsible for the web server often are not aware of all the "rules" and often only check things using IE on Win.

.
FF 92.0 - TB 78.13 - Mac OSX 10.13.6
karenanne
Posts: 630
Joined: September 18th, 2004, 5:16 am

Re: ASPX files download when trying to view PDF files

Post by karenanne »

I am having a similar problem. (Apparently there is no cmd key on Windows keyboards, so I tried start run cmd, and then stared at the command prompt window, baffled.)

Basically my question is, is there some way around this problem so that I can see the page? Both Firefox and IE and Chrome fail on this, although Chrome opens a tab with the text of the file in it.

The site is http://www.sa.dk/ao/SoegeSider/Folketaelling.aspx and I have the following settings 1921, kobstad, hjorring, skagen, and then any selection in gade.

Thanks.
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

Re: ASPX files download when trying to view PDF files

Post by trolly »

These are Java Web applications. You need a working Java install and plugin.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
karenanne
Posts: 630
Joined: September 18th, 2004, 5:16 am

Re: ASPX files download when trying to view PDF files

Post by karenanne »

Thanks, that worked.
Locked