4

My site located in folder /website

In browser it opens by url http://localhost:52912/website/

My Default page amd master page both located in root catalog

in Default.aspx i include my master page like:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default"  MasterPageFile="WTF.master" %>

In my WTF.mater i include css file:

<link href="~/css/reset.css" runat="server" rel="stylesheet" type="text/css" media="screen" />

when i run the site and look his source code in mozilla, i see css file link as:

<link href="css/reset.css" rel="stylesheet" type="text/css" media="screen" />

so, full url will be http://localhost:52912/website/css/reset.css which is correct

-css file EXISTS

-No errors in firebug like "404 not found - reset.css"

-No errors when debugging project

I can't even open this file by direct link in browser ( http://localhost:52912/website/css/reset.css ) or by link in mozilla source code viewer

It returns http://localhost:52912/website/default.aspx?ReturnUrl=%2fcss%2freset.css and i remains on the same page

I tried a whole bunch of various combinations and advices from google - nothing helps

What the..???

SOLVED: by adding

<location path="css">
        <system.web>
            <authorization>
                <allow users="*" />
            </authorization>
        </system.web>
    </location>

in web.config

3 Answers 3

10

That's because you have forms authentication turned on and you haven't allowed that css folder public access. Try adding this to the web.config:

<location path="css">
    <system.web>
        <authorization>
            <allow users="*" />
        </authorization>
    </system.web>
</location>
Sign up to request clarification or add additional context in comments.

2 Comments

Tnx pal, my suspicions were justified!
@sbxmal No probs :) glad I could help!
2

It seems you have an Authentication issue. Could you check or post your web.config file?

Comments

0

Remove the tilde (~) from the link href. It should just be

<link href="/css/reset.css" runat="server" rel="stylesheet" type="text/css" media="screen" />

Comments

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.