Getting the Response.ContentType Prior to Response.WriteFile

  • Thread starter Thread starter Robert Hanson
  • Start date Start date
R

Robert Hanson

Hi All,

I am checkinf to see if there is a way to determine the
Response.ContentType of a file residing on the server in order to set
that property prior to issuing the Response.WriteFile(FileName)?

Thanks in advance!!

Bob Hanson
Centare Group Ltd.
 
Robert,

There are one or two ways you can do this. The first would be to make a
call to the FindMimeFromData function in the WinInet library through the
P/Invoke layer.

Another way you could go about it is to get the mappings directly from
IIS (since that what you are running in). The knowledge base article titled
"Listing the Default IIS MIME Map Settings Using WSH", should help, and it
is located at (watch for line wrap):

http://support.microsoft.com/default.aspx?kbid=246068

You will have to use COM interop for this solution, which might impact
your page's performance, since you would have to set ASPCompat to true.

Hope this helps.
 
Back
Top