Every time IIS receives a request, it retrieves the requested resource (a page, image, etc.) and returns it in the HTTP channel. Imagine that the IIS response is delivered to the browser within an "envelope", and that in the header of that envelope there is a lot of extra information beyond what you asked for. One such information is the type of content inside the envelope.
The browser uses this information to decide how to open the content. If IIS says an image is a page, the browser will try to open it as a page, and vice versa.
What happens in your case is that IIS does not know what SVG is, so it sends as its default type, which is application. This always forces the download.
To resolve, you need to add the SVG type in the IIS MIME type dictionary. Follow the official documentation on how to do this: http://technet.microsoft.com/pt-br/library/cc725608(v=Ws.10). aspx
And in case one day the link breaks:
Open the IIS Manager and navigate to the level you want to manage. (...).
- Under Feature View, double-click MIME Types.
- In the Actions panel, click Add.
- In the Add MIME Type dialog box, type a file name extension in the File Name Extension text box. For example, type . Xyz.
- Type a mime type in the mime type text box. Type, for example, application/octet-stream.
- Click OK.
Just replace . Xyz with .svg. And don’t use application/octet-stream
, this is what forces downloads. Instead use image/svg+xml
.
i added using the following syntax: <staticContent> <mimeMap fileExtension=". svg" mimetype="image/svg+xml" /> </staticContent>
– JcSaint
Without changing the IIS configuration this does not do much good. The browser looks at the HTTP header first. If the header says that your SVG is an application, then the browser will treat it as an application and ignore whatever you have written in the Markup.
– Oralista de Sistemas
I made that change in iis :)
– JcSaint
Ah, it was bad. I’ve never done it this way before and I didn’t even know it was possible (or how to get on a screen that allows it).
– Oralista de Sistemas