After releasing the project, CSS fails to load properly

After creating a website in Visual Studio and deploying it in IIS, I encountered an issue where the CSS was not loading when trying to access the site. I followed some advice to update the path of the CSS file location, but that didn't resolve the problem. Upon inspecting my website using Google Chrome's web developer tools, I discovered an error message indicating that the CSS file at http://localhost:60600/Css/Master.css was not found (404 Error). Below is a snippet from my MasterPage.Master file:

<!DOCTYPE html>

<html>
<head runat="server">
<title>TheSite</title>
<link href="../Css/Master.css" rel="stylesheet" />

<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">

<div class="Header">
<div class="Header_div">
        <div class="Header_Logo">
        Automation Tools
        </div>


        <div class="Header_Menu">   
        <ul>
        <li><a href="Default.aspx">Home</a>></li>               

        <li><a href="Troubleshoot.aspx">Troubleshoot</a>></li>               

        <li><a href="">contact</a>></li>            
        <li><a href="">Help</a>></li>
        </ul>

        </div>
  </div>
  </div>





    <div>
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
        </asp:ContentPlaceHolder>
    </div>
  </form>
 </body>
</html>

The CSS file is located at "C:\inetpub\WebSite\Css\Master.css". I attempted several different ways of linking the CSS file, as shown below:

<link href="../Css/Master.css" rel="stylesheet" />
<link href="/Css/Master.css" rel="stylesheet" />
<link href="Css/Master.css" rel="stylesheet" />
<link href="../../Css/Master.css" rel="stylesheet" />
<link href="file:///C:/inetpub/WebSite/Css/Master.css" rel="stylesheet"/>

Using the link "file:///C:/inetpub/WebSite/Css/Master.css" resulted in the error message "Not allowed to load local resource: file:///C:/inetpub/WebSite/Css/Master.css".

If anyone can offer assistance, it would be greatly appreciated.

Thank you in advance.

Answer №1

Make sure to include the .CSS extension in the MIME TYPES and REQUEST FILTERING settings of IIS.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Auto-selecting the first item in a CSS menu when the switcher is tapped on mobile devices

Struggling with a responsive CSS menu on my website, . The switcher on mobile seems to automatically click the first item in the menu (Home) as I open it, redirecting me instantly. When setting the link to "#" everything is fine, but then I lose the home l ...

Interested in mastering the art of storing data in forms using PHP? Ever wondered why this functionality doesn't seem to function in an HTML file?

Hello, I'm new to coding and I need some help. Recently, I learned how to create forms in HTML and now I want to save and display the data using PHP. I followed along with some PHP exercises on a website called W3Schools, but when I tried to run the f ...

jQuery template does not respond to input text when a click event is enabled on an iPhone device

Below is a jQuery template I have: <div class="parent-class"> <div class="sub-class"> <div clas="sub-input-class"> <input type="text" /> </div> </div> </div> Recently, I ...

Issue with Tailwind and MUI integration causing unanticipated error with white buttons in NextJS Project

I'm in the process of developing a project using NextJS, TailwindCSS, and MUI React UI library. While integrating an MUI Button into my project, I noticed that the button's color remains white despite styling changes. https://i.stack.imgur.com/ ...

When trying to click the button in Navbar.jsx, I encounter an error when attempting to invoke the setShowCart(true) function

I've encountered an issue while trying to call the setShowCart(true) function in Navbar.jsx. I'm unsure of how to fix this. import React from 'react' import Link from 'next/link'; import {AiOutlineShopping} from 'react-ic ...

The divs are crashing into each other and moving at varying speeds

I have created a mini game inspired by diep.io on codepen, where you can upgrade your reload and shooting capabilities. However, I have encountered an issue where the bullets start moving at different speeds and end up overlapping each other after shooting ...

Is it necessary to define all presentational images in CSS?

Lately, I've been diving into the world of (X)HTML & CSS and have come to understand that HTML is meant for structure while CSS is used for presentation. It makes me wonder if a significant portion of images on websites are more about enhancing p ...

One-of-a-kind Version: "Utilizing CSS to Capitalize an

Imagine having the following strings. i and we. me and you. he and she. Is it possible to achieve the desired result using PURE CSS? I and We. Me and You. He and She. If capitalizing the text using text-transform: capitalize is used, it will yi ...

What is the best way to combine the average hours, minutes, seconds, and milliseconds in JavaScript?

I am seeking guidance on how to calculate the average of three different times in JavaScript. In the scenario presented below, the average of the three times is calculated as 01:42:22:566. <form action="/action_page.php"> <label for= ...

Hiding the overflow conceals the entire image in one direction, while leaving the other exposed

Here is the code I have written for my project (view fiddle here): img { width: 200px; height: 200px; } .image-container { width: 600px; height: 200px; overflow: hidden; } I am working with multiple images, all sized at 200px by 200p ...

Initiate an asp.net event originating from a control positioned outside of the update panel

I am facing a tricky situation where I have checkboxes being used as filters for a repeater, placed inside a jQuery accordion. The issue arises when using an AJAX update panel, causing the jQuery accordion to stop functioning. My goal is to have the filt ...

Incorporate a font-awesome icon directly within the input field

My div element contains a span element, which in turn includes an i tag. However, the i element extends outside of both the span and div elements. I am attempting to place an eye icon inside an input field. Here is my current code - what adjustments shou ...

Creating an interactive table with the power of FPDF and PHP

I have developed a unique Invoice System that allows users to customize the number of headings and fields using FPDF in conjunction with PHP. Subsequently, I can input the heading names and field values into HTML input fields. However, I am encountering a ...

The sub-menu is being obscured by a PDF element in Internet Explorer, causing visibility issues

I have an object type tag on my page that displays a PDF file. Everything is functioning correctly, but in Internet Explorer, my sub-menu is being hidden behind the object tag. var objTag = $('<object></object>') .attr({ data: source ...

Serve the mobile version to mobile visitors and the desktop version to all other visitors

Can someone please explain to me how I can display the Mobile Version of a website when visiting on my phone, and the Desktop Version when viewing on anything larger than 500px? I have separately created both a Mobile Website and a Desktop Website. Is it ...

An individual browsing through a different user's profile on the Django platform

I'm trying to create a feature where one user, A, can click on the profile picture of another user, B, and be redirected to B's profile automatically. Any suggestions on how I can achieve this? Take a look at my HTML code where I mentioned someth ...

Taking out arbitrary raphael shapes from the drawing board

In my current project, I am utilizing raphaeljs and socketIO to create a real-time data display. The canvas features circles that represent nodes, and these circles are stored in an object called nodeStatus, with the format nodeStatus[id].obj where the "id ...

Guide on updating directory images by uploading a new one directly onto the site

As someone who is new to HTML, I have a question about updating images on my website through an "admin" page. Currently, I have two websites set up - the main site displays an image from the "images" folder, and the second site serves as an admin page. M ...

Is the Debug attribute for WCF .SVC being disregarded during release compilation?

Is the Debug="true" attribute in a .SVC file ignored when compiling for release, or are debug symbols still included? For example: <%@ ServiceHost Language="C#" Debug="true" Service="WebPages.Interfaces.example" CodeBehind="example.svc.cs" Factory="Sy ...

What steps do I need to take to create a custom image for a website?

I'm looking for a way to create a website image using just code, without the need for an actual image file or image tag. Is there a method to do this? Would I use CSS, Javascript, or HTML5 for this task? If using JavaScript to dynamically generate the ...