Why do they use ASPX?

Often I will click a link to download a PDF. Often, the link is actually an aspx… script?.. that commands the browser to retrieve the PDF. Often, this doesn’t work, and sometimes even crashes my browser.

Why? Why not just post a link to the PDF? Why put this crap in the way? What’s the benefit in writing additional code for a protocol that’s apparently not well implemented?



Lots of reasons. The pdf might be in a database, or be stored somewhere similarly inaccessible. It might need to be dynamically generated.

Incidentally, I don’t see how the aspx page could at all be responsible for your browser crashing; I’d be much more inclined to blame an iffy pdf plugin.

The extension is pretty much immaterial to your browser when deciding whether to consider the content to be a pdf document. This is dictated by a header (unseen by you, but sent by the server to your browser) which describes the content type of the data being sent. As Nanoda mentioned, this allows the content itself to be served up dynamically (pulled from a database, rendered on the fly, etc.). It need not be a physical file sitting in a directory on the server.

If you’re curious about the mechanics of it, here’s a page that gives you a look behind the scenes at four ways PDF content can be served by an asp (or aspx) page.

I would also agree with Nanoda that the problem likely resides with your plugin or its configuration. Have you tried loading the same file with Chrome? It has a native pdf renderer that takes some of the headache out of this.