Web application using ASP.NET and VB.NET.
I want to decorate Label etc. using CSS.

Error message

CSS is not applied only in the local environment using IIS. (Check with Firefox and Google Chrome)
CSS is applied when it is published to Microsoft Azure and launched from Visual Studio.

Applicable source code

"style.css" exists in the same directory.

<% @ Page Language = "vb" AutoEventWireup = "false" CodeBehind = "(file name) .aspx.vb" Inherits = "(solution name). (file name)"%>
<! DOCTYPE html>
<html xmlns = "http://www.w3.org/1999/xhtml">
<head runat = "server">
<meta http-equiv = "Content-Type" content = "text/html;charset = utf-8" />
    <link rel = "stylesheet" href = "style.css" type = "text/css" />
<!-Label etc. are written here->
    background-color: black;
    color: white;
    width: 400px;
    text-align: right;
    text-align: right;
    color: deepskyblue;
    color: red;
    color: lime;
    color: yellow;

Link's href "style.css" was prefixed with "./" (on the contrary, an error occurred and stopped working).
Added read permission to "Everyone" in folder sharing settings.

Supplemental information (FW/tool version etc.)

The OS is Windows10 Pro.

  • Answer # 1

    Is IIS static content enabled?

    Enable or disable Windows features>Internet Information Services>World Wide Web Services>HTTP Common Features>Static Content

  • Answer # 2

    First check IIS access logs Please try.
    What is the status code for accessing style.css?
    If it is 200, it may be a problem with the description, and if it is 404, it may be a problem with the file layout or file name.
    If it is 304, try a super reload.

    Check the contents of style.css placed in IIS

    Check the file name. Whether exactly style.css?
    In the past question, there was a person who didn't notice because it turned off the extended display and doubled the extension. (like style.css.css)

  • Answer # 3

    Isn't it reflected even if you write CSS directly instyleinhead?

      body {
        background-color: black;
        color: white;

    If there is a cache problem, adding the query string ("? ~~") can also cancel the cache (it seems that the browser will misunderstand that it is a separate file)

    <link rel = "stylesheet" href = "style.css? 20180831" type = "text/css" />

    Remember this if you are going to mess around with CSS regularly in a short period of time (though it doesn't seem to be relevant this time)


    If you write directly, CSS will be reflected

    I think that the fact that CSS written directly works is not a problem with the CSS description itself

    If the description is still wrong,<link />might be/>
    *linktag is closed and no tag is required.
    cf. Basic way of writing start/end tag of html tag in HTML5 and element which does not need closing tag

    Also,xmlns ="http: //www.w3.org/1999/xhtml&seems unnecessary in HTML5, so this is also the cause of the error (HTML misinterpretation by browser? ) May have been
    cf.Basic HTML5 you need to know [Document structure]