2017-07-31 68 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 /”。 –