0

I modified main.min.css and main.full.css (setting another color of background) and page now cannot render css. It's just a HTML.

Master page: (shortened version with links)

<%@ 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>

at the end of this file link to script:

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

and I also got a warnings and error in Chrome console:

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 <

16
  • 1
    Which library you have modified? Is it bootstrap one or other one? Commented Jul 31, 2017 at 8:14
  • @PowerStar I just modified main.min.css and main.full.css. And maybe some of .aspx pages. Commented Jul 31, 2017 at 8:16
  • What kind of edit have you made? What css file was? Where you using a library? Commented Jul 31, 2017 at 8:16
  • 1
    Please confirm you have mentioned file name correctly. Commented Jul 31, 2017 at 8:17
  • 1
    If you look at the error messages, it is pretty obvious that the system is trying to redirect the requests for those stylesheets via the login page ... so you somehow managed to make your stylesheets content that is only visible to logged-in users, which is rather not what you want ... Commented Jul 31, 2017 at 8:25

3 Answers 3

1

Change:

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

to

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

you need to close the label with '/'

check this post too, seems to be the same problem:

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

Sign up to request clarification or add additional context in comments.

7 Comments

try to add type="text/css" and close properly meta tags too
Stays the same. I think probably it will be something with web.config
if this doesn`t work, can you share the whole file code, plz?
It has 46k characters, which is above the limit of 30k characters, where can I place it?
|
0

You must add .css MIME type with text/css value into IIS. Currently, the web server does not understand what .css means.

This will work when the content-type response header value is set to text/css.

1 Comment

I have in MIME types .css (inherited)
0

You need to exclude the css files and images from getting authenticated as following in the configuration file. Using the location tag you can exclude a single file or a directory.

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

9 Comments

Should I add it to the end of Web.config? Can you give an example of relative path?
Inside configuration tag.
Yes in your case "/App_Firma/".
Should I use "\App_firma\css\" ?
If you want to allow script also then use /App_firma/ or only css then include css directory too.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.