Question

I've tried researching my problem but I can't find anything that answers my question. I'm sure the answer is out there somewhere, all though, I don't know what to specifically search for, therefore, I'd like to apologize in advance.

My code:

<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="cph_head" runat="server">
        <link href="/assets/css/layout.css" rel="stylesheet"  runat="server" />
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
        <script src="//use.edgefonts.net/source-code-pro.js"></script>
        <script src="/assets/scripts/modernizr.js"></script>
    </asp:ContentPlaceHolder>
</head>

As you can see, my stylesheet should have been added there, I've put a slash infront of the path to make sure it works no matter which folder you're in. However, when I put the slash infront of it, it's not working. If I remove the slash it works fine.

I'm using Visual Studio 2012 and I'm working in ASP.NET Webforms. I hope someone can help me. This issue isn't happening on my laptop, even with the same project, but unfortunately it's happening here on my stationary pc.

I hope you can help me, thank you very much in advance.

Was it helpful?

Solution

I assume, thats you master page markup, so try it like this:

<head runat="server">
    <title></title>
    <link href="/assets/css/layout.css" rel="stylesheet"  runat="server" />
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
    <script src="//use.edgefonts.net/source-code-pro.js"></script>
    <script src="/assets/scripts/modernizr.js"></script>
    <asp:ContentPlaceHolder ID="cph_head" runat="server">

    </asp:ContentPlaceHolder>
</head>

The asp:ContentPlaceHolder should stay empty at your master page. it is overridden by what is on you child pages.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top