无法引用外部CSS

时间:2012-12-19 19:42:34

标签: c# asp.net css

-->

我正在尝试在我的site.master页面上使用来自CDN的CSS文件。 CSS位于http://cdn.meriranchi.com/styles/site.css。我尝试了下面的许多变化,但没有运气。

site.master具有以下标记:

<head runat="server">
    <title>::MeriRanchi:: Ranchi ka search engine. Ranchi's 1st of its kind, City Search.
        Search for the shops, institutes , tourist spots , emergency services etc with ease.
    </title>
    <link rel="shortcut icon" href="favicon.ico" />
    <link  rel="stylesheet"  id="CssFile" runat="server"/>
          <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>

在我后面的代码中,我向CssFile添加了一个href属性:

CssFile.Attributes.Add("href","http://cdn.meriranchi.com/Styles/Site.css");

以上在IE9中呈现以下HTML:

<head><title>
    ::MeriRanchi:: Ranchi ka search engine. Ranchi's 1st of its kind, City Search.
        Search for the shops, institutes , tourist spots , emergency services etc with ease.

</title><link rel="shortcut icon" href="favicon.ico" /><link id="CssFile" rel="stylesheet" type="text/css" href="http://cdn.meriranchi.com/Styles/Site.css" /><meta name="description" content="schools and colleges in ranchi,restaurants in ranchi,coaching institutes in ranchi,shopping complex in ranchi,shopping mall in ranchi,best cloth store in ranchi
best college in ranchi,best school in ranchi,showrooms in ranchi,authorised dealers in ranchi,grocery stores in ranchi,falls in ranchi,tourist places in ranchi,zoo in ranchi,tourist spots in ranchi,
schools and colleges, BIT Mesra, RINPAS, CIP Ranchi, Ranchi Mental Hospital, HEC, dams in ranchi, jagannathpuri rath mela, hadia, hadiya, hariya, morhabadi maidaan, firayalal chowk, 
" /><meta name="keywords" content="tourist places in ranchi, tourist spots in ranchi, business listings in ranchi, shops in ranchi, schools colleges in ranchi, restaurants in ranchi, movies in ranchi, jobs in ranchi,real estate deals in ranchi" />
</head>

1 个答案:

答案 0 :(得分:2)

您的浏览器很可能认为它已经拥有外部源CSS文件的副本。您可以通过在浏览器的开发人员工具中查看网络请求流量来检查这一点,以确保它请求该文件的新副本。

如果浏览器不是,您应该按pressing CTRL + F5进行整页刷新。

相关问题
最新问题