SVG still doesn't show up after adding mime type
I am trying to display an svg image.
When I display the svg image with the below code, it is not displayed.
<img src="/img/logo.svg" alt="Logo">
I also tried this syntax, but then it loads instead of being displayed.
<embed type="image/svg+xml" src="/img/logo.svg" />
I have already set the mime type to image / svg + xml in web.config.
<staticContent>
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<remove fileExtension=".svgz" />
<mimeMap fileExtension=".svgz" mimeType="image/svg+xml" />
</staticContent>
The file type seems to be application / octet-stream, although I defined it in image / svg + xml. I am running an ASP.NET site with IIS 7.
+3
source to share
3 answers
Add the following to your web config:
<system.webServer>
<staticContent>
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>
<handlers>
<add name="SVG Handler" path="*.svg" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Unspecified" />
</handlers>
</system.webServer>
0
source to share