1

I Created a simple ASP MVC View but when i try to use Sass nothing happen in firefox or chrome. when i inspected the page in Chrome the following error appeared:

Request URL:http://localhost:29120/Views/UI/test.css
Request Method:GET
Status Code:404 Not Found

And network response is

 <head>
        <title>The resource cannot be found.</title>
    enter code here
</head>
<body bgcolor="white">

            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

            <h2> <i>The resource cannot be found.</i> </h2></span>

            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

            <b> Description: </b>HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. &nbsp;Please review the following URL and make sure that it is spelled correctly.
            <br><br>

            <b> Requested URL: </b>/Views/UI/test.css<br><br>

            <hr width=100% size=1 color=silver>

            <b>Version Information:</b>&nbsp;Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34212

            </font>

    </body>
<!-- 
[HttpException]: Path &#39;/Views/UI/test.css&#39; was not found.
   at System.Web.HttpNotFoundHandler.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
-->

Index.cshtml

<head>
 <link href="~/Views/UI/test.css" rel="stylesheet"/>
<title>title</title>
</head>

I checked IIS directory and the file does exist.

Currently I'm using MVS 2013 Ultimate Update 4, so any idea why it's not working?

4
  • How are you compiling the Sass? Commented Jan 5, 2015 at 0:18
  • Using visual studio, it does automated compilation to css Commented Jan 5, 2015 at 0:50
  • If the Sass compiles correctly, this is not a Sass problem. It sounds like you're either using the wrong path to the CSS or it isn't being served correctly. Commented Jan 5, 2015 at 22:12
  • it's the correct path i already dragged and dropped it to be sure, How to check if it's served correctly or not?! Commented Jan 6, 2015 at 0:09

1 Answer 1

1

The reason for the 404 response could be because you have the css file within a subdirectory of Views.

By default, all files within the Views folder aren't served due to the web.config in the Views folder containing this setting under <system.web>:

<httpHandlers>
    <add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
</httpHandlers>

You could change the above setting but I would recommend moving your sass and css out into a higher level directory.

More here: Haacked article

Sign up to request clarification or add additional context in comments.

1 Comment

It worked but when i moved the css into another folder(~/Content/test.css). so the error didn't just happen because it was in sub-directory of Views, it happened because it was in Views folder or so it seems.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.