C # Font Library cross-domain resolution

Source: Internet
Author: User

Most of the information on the web is said to be in the case of Apache and NG servers, but the basic idea is to add a response header

Scene:

Page reference CSS file:

<link href= "Http://www.tuohuangzu.com/content/Company_v2/register/css/font.css" type= "Text/css" rel= " Stylesheet "/>

Defined in style:

@font-face {
font-family: ' Uninf-icon-usual ';
Src:url (' fonts/uninf-icon-usual.eot?-ny5g1a ');
Src:url (' Fonts/uninf-icon-usual.eot #iefix-ny5g1a ') format (' Embedded-opentype '),
URL (' fonts/uninf-icon-usual.ttf?-ny5g1a ') format (' TrueType '),
URL (' fonts/uninf-icon-usual.woff?-ny5g1a ') format (' Woff '),
URL (' fonts/uninf-icon-usual.svg?-ny5g1a#uninf-icon-usual ') format (' SVG ');
Font-weight:normal;
Font-style:normal;
}

The use of font libraries has led to cross-domain, prompting TTF and Woff to raise cross-domain issues in Firefox

Workaround:

protected voidApplication_BeginRequest (Objectsender, EventArgs e) {                       varURL =HttpContext.Current.Request.Url.AbsolutePath; if(URL.) LastIndexOf (".", stringcomparison.ordinal) >0)            {                varstr = URL. Substring (URL. LastIndexOf (".", stringcomparison.ordinal)); if(str = =". TTF"|| str = =". Woff") {HttpContext.Current.Response.AddHeader ("Access-control-allow-origin","*"); }            }                                }

C # Font Library cross-domain resolution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.