I have an asp.net MVC application that has one section /admin
locked down via windows authentication. I have achieved this by doing the following.
Web.Config
<authentication mode="Windows" />
AdminController
[Authorize]
public class ContactController : Controller
{
....
}
This works as it should. When I try to access the /admin
URI it prompts me for a windows login.
However, in my /Views/Admin/Index.aspx
view, I am linking to two files:
<script src="/media/js/site.js"></script>
<style href="/media/css/styles.css" ... />
For some reason IIS is prompting me for a windows login for each of these files too.
So why is windows prompting me to authenticate for the CSS & JS files?
Any help would be greatly appreciated.
As with most problems like this, turns out it was a permissions error.
I gave "Read" access on the media folder to the windows user that I was logging in with and bam it all works dandy now.