2017-07-31 65 views
0

我修改了main.min.css和main.full.css(設置另一種顏色的背景)並且頁面現在無法呈現css。這只是一個HTML。無法在ASP.NET中呈現css

母版頁:(縮短版的鏈接)

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="ZASshop.master.cs" Inherits="ZASshop.NET.ZASshop" %> 
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %> 
<%@ Register Assembly="ZAScontrols" Namespace="ZAScontrols" TagPrefix="zas" %> 
<!DOCTYPE html> 

<html xmlns="http://www.w3.org/1999/xhtml" > 
    <head id="MasterHead" runat="server"> 
     <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> 
     <title></title> 
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 

     <link href="/App_Firma/css/main.min.css" rel="stylesheet" type="text/css" media="screen" /> 
     <link href="/App_Firma/css/firm.css" rel="stylesheet" type="text/css" media="screen" /> 
     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css"> 
     <link href="/App_Firma/DayPilot/Themes/scheduler_8.css" rel="stylesheet" type="text/css"/> 
     <link href="/App_Firma/css/custom.css" rel="stylesheet" type="text/css" media="screen"/> 
       <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 

在此文件鏈接的結束腳本:

<script src="/App_Firma/js/app.min.js"></script> 

,我還得到了警告和Chrome控制檯中的錯誤:

LoginPage.aspx:7 Resource interpreted as Stylesheet but transferred with MIME type text/html: " http://localhost/LoginPage.aspx?ReturnUrl=%2fApp_Firma%2fcss%2fcustom.css ". LoginPage.aspx:7 Resource interpreted as Stylesheet but transferred with MIME type text/html: " http://localhost/LoginPage.aspx?ReturnUrl=%2fApp_Firma%2fcss%2ffirm.css ". LoginPage.aspx:7 Resource interpreted as Stylesheet but transferred with MIME type text/html: " http://localhost/LoginPage.aspx?ReturnUrl=%2fApp_Firma%2fcss%2fmain.min.css ". LoginPage.aspx:7 Resource interpreted as Stylesheet but transferred with MIME type text/html: " http://localhost/LoginPage.aspx?ReturnUrl=%2fApp_Firma%2fDayPilot%2fThemes%2fscheduler_8.css ". LoginPage.aspx?ReturnUrl=%2fApp_Firma%2fjs%2fapp.min.js:2 Uncaught SyntaxError: Unexpected token <

+1

您修改了哪個庫?它是自舉的還是其他的? –

+0

@PowerStar我剛剛修改了main.min.css和main.full.css。也許一些.aspx頁面。 –

+0

你做了什麼樣的編輯?什麼CSS文件是?你在哪裏使用圖書館? –

回答

1

變化:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font- 
awesome/4.6.1/css/font-awesome.min.css"> 

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font- 
awesome/4.6.1/css/font-awesome.min.css" type="text/css"/> 

你需要關閉以 '/'

檢查標籤這個帖子似乎也出現同樣的問題:

Resource interpreted as Stylesheet but transferred with MIME type text/html in ASP.NET IIS

+0

好吧,但是這並沒有解決問題 –

+0

嘗試添加'type =「text/css」'並關閉正確meta標籤 – Ferus7

+0

保持不變。我想可能這將是web.config –

0

您必須將帶有text/css值的.css MIME類型添加到IIS中。目前,Web服務器不瞭解.css的含義。

這將在內容類型響應標頭值設置爲text/css時起作用。

+0

我有MIME類型.css(繼承) –

0

您需要從配置文件中排除css文件和圖像以進行身份​​驗證。使用位置標記可以排除單個文件或目錄。

<location path="<relatevie path of your css files>"> 
    <system.web> 
     <authorization> 
      <allow users="*"/> 
     </authorization> 
    </system.web> 
</location> 
+0

我應該將它添加到Web.config的末尾嗎?你能舉一個相對路徑的例子嗎? –

+0

配置標籤內部。 –

+0

是你的情況「/ App_Firma /」。 –