Visual Studio Not Displaying Svg Image As Background
I have a asp.net project with a html file(Html 5). I am trying to set the SVG as background of my body tag using the CSS 3. I have my file like this. In my Style.css. when i doub
Solution 1:
My workaround for this was to create my own httphandler locally which overwrote the content-type for svg.
publicclassSvgHandler : IHttpHandler
{
publicbool IsReusable
{
get { returnfalse; }
}
publicvoidProcessRequest(HttpContext context)
{
context.Response.ContentType = "image/svg+xml";
context.Response.BinaryWrite(File.ReadAllBytes(context.Request.PhysicalPath));
context.Response.End();
}
}
and in web.config i added:
<httpHandlers><addverb="*"path="*.svg"type="SvgHandler" /></httpHandlers>
with this solution you don't have to use IIS express, you can just use the regular development server in visual studio 2010
Solution 2:
The built-in Visual Studio web server only has a limited set of mime-types it can serve. SVG is not one of them.
See here for a concise answer: https://serverfault.com/questions/359904/how-to-configure-iis-for-svg-and-web-testing-with-visual-studio
Post a Comment for "Visual Studio Not Displaying Svg Image As Background"