Re: Auto detect content-type
From: Kevin Spencer (kevin_at_DIESPAMMERSDIEtakempis.com)
Date: 02/07/05
- Next message: Kevin Spencer: "Re: Security problem/issue ASP.Net"
- Previous message: Eirik Eldorsen: "Re: ad managment"
- In reply to: Grzegorz Kaczor: "Auto detect content-type"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 7 Feb 2005 11:16:29 -0500
MIME types are usually recognized by the file extension. When the file
extension doesn't match the MIME type, the Response.ContentType header must
be set, to let the browser know. So, if you want to "autodetect" the MIME
type, you're going to have to do one of the following:
1. Read the file extension
2. Know what the type of file is by some other means
Then you have to set the Response.ContentType to that MIME type in the
Response.
-- HTH, Kevin Spencer Microsoft MVP .Net Developer Neither a follower nor a lender be. "Grzegorz Kaczor" <grzegorz.kaczor@cc.com.pl> wrote in message news:cu829h$h0k$1@nemesis.news.tpi.pl... > Hello, > > I wanted to use Response.TransmitFile to return an image instead of a HTML > page. Under IE everything works well, but under Mozilla/Firefox the image > is treated as it were text/html. > > When I set up content-type in response to image/jpeg everything works > well. > > But I would like to send any file instead of an image and thus I cannot > always know the proper content type. Is it possible to "autodetect" a file > content type? Or make IIS perform an "invisible redirect" (something like > Server.Execute but with local path name instead of URL) so that default > IIS mechanisms of content-type detection were used? > > Thanks > Grzegorz Kaczor
- Next message: Kevin Spencer: "Re: Security problem/issue ASP.Net"
- Previous message: Eirik Eldorsen: "Re: ad managment"
- In reply to: Grzegorz Kaczor: "Auto detect content-type"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|