s.k.paul s.k.paul - 4 months ago 33
CSS Question

Adding .css in ASP.Net 5 MVC 6

I am trying to explore MVC6 application. I selected Framework 4.6 and Empty ASP.Net preview template. Using Visual studio 2015.

I have .css file under

wwwroot/css
directory.

And trying to use in index.cshtml as

<link href="../../css/css.css" rel="stylesheet" />


also tried

<link href="~/css/css.css" rel="stylesheet" />


But it's not working. Is here any technique required?

Answer

You have to tell ASPNET5 to use static files. In startup.cs add

app.UseStaticFiles();

in the Configure() function

Comments