[thelist] creating and delivering a formatted document with classic asp

Shawn K. Quinn skquinn at speakeasy.net
Wed Feb 21 15:33:46 CST 2007


     [Sarah originally wrote:]
> >> I just want to deliver the file directly to the user, i.e. make the file
> >> downloadable for them. I don't care whether the file gets saved to the
> >> server, but if this step is necessary, that's fine.

  [Erik Mattheis replied:
> > Why not just serve up a HTML file with an rtf or doc extension?

On Wed, 2007-02-21 at 11:40 -0400, Sarah Adams wrote:
> Would that even work? It just seems *wrong*.

URLs aren't filenames, and thus do not have filename extensions. As long
as the Content-Type header is text/html there is nothing non-standard
about serving an HTML file with a URL ending in .rtf, .doc, or for that
matter even .mp3, .gif, .jpg, or .txt, or no "extension" at all. In
fact, some sites are served with URLs like
http://www.example.com/my-document where the local filename is actually,
say, my-document.txt on the local disk (see the Apache documentation for
"Option MultiViews", which has been around since at least 1.3.x if not
earlier).

The only reason it *seems* wrong to you are the widespread myths that:
1) the URL has to map to a filename and directory path on the local disk
(it doesn't as explained above), and 2) what would be the filename
extension on the URL if it was a filename identifies what is at that URL
(it doesn't, Content-Type does).

In order to actually do this, given an Apache server, one would have to
turn on Option MultiViews and rename the file to something like
document.rtf.html.

-- 
Shawn K. Quinn <skquinn at speakeasy.net>




More information about the thelist mailing list