s.k.paul s.k.paul - 1 year ago 151
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


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 Source

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


in the Configure() function

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download