Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 08, 2012 05:47 PM by mud8541
Aug 02, 2009 09:45 AM|LINK
I have a feeling this question may have already been answered a hundred times, if so, sorry, but I could not find the solution.
I have just created a brand new MVC application (the default app) and when I run it from within VS2008 (using Cassini) everything works fine whether I am logged-in to the app or not. If I view source, the path to the CSS file is Content/Site.css.
Then I setup a virtual directory in IIS7 (on Windows 7 Ultimate) and when I access the same application via
http://localhost/myapp/ I am immediately forwarded to the account login page and the CSS path is incorrect for some reason (../Content/Site.css), so there is no formatting. If I register a new user for the app and then log-in,
the CSS path is correct (Content/Site.css) and the formatting appears. But as soon as I log off and reload the page, the formatting once again disappears. This seems odd.
I'm thinking there is something simple that I am overlooking. Can somebody give me a clue? Thanks!
Aug 02, 2009 11:26 AM|LINK
Maybe try with Url.Content() helper.
Aug 02, 2009 01:28 PM|LINK
This sounds like an authentication issue i.e. before you login you have no permission to access any resource in the site, MVC pages however because they go throught routing are OK so you may need to add somthing like:
Assuming your css is in the default folder ~/Content see
Aug 02, 2009 07:44 PM|LINK
Hi, thanks for the replies. I tried your suggestions but kept getting the same results.
After poking around a bit more I found the solution:
In IIS Manager, I had to go to my app, go into Authentication, select Anonymous Authentication, under Actions on the right-hand side click Edit. It was set to use "Specific user: IUSR". I changed it to use "Application pool identity". Now all works fine.
Nov 08, 2012 05:47 PM|LINK
Thanks a million for posting the fix. Good forum etiquette is so rare.