 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Mark Tiede Guest
|
Posted: Fri Feb 02, 2007 2:52 am Post subject: MimeTypes for returned content |
|
|
On my ISAPI web page, I may have references to jpg and svg files. I seem to
remember when I initially coded this stuff I had some sort of trouble with
MimeType content for SVG not being recognized so I added code to have my web
app return the content mime type. (the problem may have been that the web
request did not end in .svg and it didn't know what to do. I later added
..svg to the reference name so it could determine the extension of the file.)
Now, I am going to allow references to more kinds of objects. And I am
going to be giving back the content for those things.
The users will be using a GUI app to tell me what files they want references
to on the web page. Should I be telling the browser from the web content
what mime type it is? Or can I count on IIS to look up the mime type in the
registry based on the extension and return the mime type it is?
One area of confusion for me is that for jpeg, for instance, there are 2
registered mime types for .jpg files. So which one would IIS return to the
client browser?
Or should I ask the user in the GUI what mime type his file is and then
return that with the object content? |
|
| Back to top |
|
 |
Mark Tiede Guest
|
Posted: Tue Feb 13, 2007 7:25 pm Post subject: Re: MimeTypes for returned content |
|
|
Ah ha!
I think I got it. I made the mime-type application/x-url. Others may also
work, but that one did...
Thanks anyway. |
|
| Back to top |
|
 |
Mark Tiede Guest
|
Posted: Sun Mar 11, 2007 6:57 pm Post subject: Re: MimeTypes for returned content |
|
|
All,
Should I be getting the allowed mimetypes from the registry on the server
rather than me maintaining my own table of mimetypes?
How can I check from a browser what mime-type is actually being sent down
for a document? Does IIS put its own mime-type on instead of using the one
I set in my ISAPI dll? |
|
| Back to top |
|
 |
Nicholas Brooks Guest
|
Posted: Mon Mar 12, 2007 7:03 am Post subject: Re: MimeTypes for returned content |
|
|
Mark,
| Quote: | Should I be getting the allowed mimetypes from the registry on the server
rather than me maintaining my own table of mimetypes?
|
I'm assuming you are streaming the files using ISAPI - I'd just read from the registry, which is what IIS ultimately does (unless a particular website under IIS overrides the mime type). Perhaps look at caching the looked up mime types (since they wouldn't change very often) if you don't want to hit the registry for every request.
Just throwing this out there - Is it possible to let IIS handle the file request? E.g. User requests http://www.example.com/myapp.dll/resource/filexyz and you do a http 302 redirect to the actual file at http://www.example.com/files/filexyz. That way you don't have to really worry about mime types (unless they are unknown types). The potential problem with this approach is that the user may end up requesting the file directly without going through your app. So a security/permission problem if that is the aim of the app.
| Quote: | How can I check from a browser what mime-type is actually being sent down
for a document? Does IIS put its own mime-type on instead of using the one
I set in my ISAPI dll?
|
If your testing on I.E. then look at using Fiddler: http://www.fiddlertool.com/. You can see the raw request and response between browser and server.
As far as IIS and your app goes, I don't think IIS does anything to the response at all (other than encrypting it if it was https). Check out http://msdn2.microsoft.com/en-us/library/ms525172.aspx for more info.
Cheers
Nicholas |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|