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.