Setting the MIME type in asp.net

I have a website and in the Chrome inspector, I get the following:

Resource interpreted as Font but transferred with MIME type application/octet-stream.

Where can I configure the MIME types in the asp.net framework (and not through the IIS console) to remove this warning? I am using a font that I downloaded from a protein squirrel with the extension .ttf.

Thank.

+5
source share
1 answer

Ok, no access to IIS:

The key here is, instead of linking to the font file in html or css, you create an asp.net document that sets its own mime type and then sends the contents of the font file.

An example of loading the myfont.aspx page: (completed with your relevant data)

Response.ContentType = "YourMimeType/Type"
Response.AddHeader("Header Name", "Header value")
Response.WriteFile("font.ttf")
Response.End()
Response.Clear()

Then a link to myfont.aspx

, : myimage.aspx, csv, .

:

http://weblogs.asp.net/stoianbucovich/archive/2008/05/26/using-http-header-to-send-file.aspx

http://www.xefteri.com/articles/show.cfm?id=8

http://forums.asp.net/p/1204802/2109808.aspx

+4

All Articles