I've a asp.net mvc 3 site and i publish it in iis 7.5 (framework 4.0), the problem is that the css and the scripts don't work util the user log in the website. So:
The website was created like virtual directory and converted into a application.
The mode is forms authentication.
I enable in the iis the forms and anonymous authentication.
You need to exclude the css files and images from getting authenticated as following in the configuration file. Using the location tag you can exclude a single file or a directory.
I figured it out. It was something I missed from my checklist when setting up a new IIS application: Select the application, double-click "Authentication", select "Anonymous Authentication", then Edit, and change it to use the
Application Pool Identity. Make sure that user has permissions on the folder that contains the site.
Marked as answer by Vecthor on Feb 15, 2012 12:01 PM
Vecthor
Member
19 Points
27 Posts
Css and Scripts don't work until the user log in the website - Asp.NET MVC 3 Web Site
Feb 08, 2012 11:04 AM|LINK
I've a asp.net mvc 3 site and i publish it in iis 7.5 (framework 4.0), the problem is that the css and the scripts don't work util the user log in the website. So:
The web config has:
Obs: the dlls that i add in bin directory: System.Web.Helpers.dll, System.Web.Mvc.dll, System.Web.Routing.dll, System.Web.WebPages.dll.
I tried to change the path in the localtion as "~/Content", but i got the same result.
I tried to put the tag allow in the autorization tag as:
But i got the same result.
What am i missing?
</div> </div>Routing web.config asp.net-mvc
necro_mancer
Star
8169 Points
1595 Posts
Re: Css and Scripts don't work until the user log in the website - Asp.NET MVC 3 Web Site
Feb 09, 2012 04:13 AM|LINK
hi vector,
May I know how did you "publish" your project? Are you using webdeploy or FTP tools? Additionally, do you have a direct access to the server?
Routing web.config asp.net-mvc
Professional SQL 2008 R2 Service
Vecthor
Member
19 Points
27 Posts
Re: Css and Scripts don't work until the user log in the website - Asp.NET MVC 3 Web Site
Feb 09, 2012 10:54 AM|LINK
I'm using the visual studio 2010 ultimate to publish it. And yes, i have full control to the server.
Dino He - MS...
Star
8068 Points
1023 Posts
Microsoft
Re: Css and Scripts don't work until the user log in the website - Asp.NET MVC 3 Web Site
Feb 15, 2012 03:07 AM|LINK
Hi
You need to exclude the css files and images from getting authenticated as following in the configuration file. Using the location tag you can exclude a single file or a directory.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
Vecthor
Member
19 Points
27 Posts
Re: Css and Scripts don't work until the user log in the website - Asp.NET MVC 3 Web Site
Feb 15, 2012 11:21 AM|LINK
I did this, there is in my question:
<location path="Content" allowOverride="true">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="Scripts" allowOverride="true">
<system.web>
<authorization>
<allow users="*" />
</authorization>
<globalization culture="pt-BR" uiCulture="pt-BR" />
</system.web>
</location>
Vecthor
Member
19 Points
27 Posts
Re: Css and Scripts don't work until the user log in the website - Asp.NET MVC 3 Web Site
Feb 15, 2012 12:00 PM|LINK
I figured it out. It was something I missed from my checklist when setting up a new IIS application: Select the application, double-click "Authentication", select "Anonymous Authentication", then Edit, and change it to use the Application Pool Identity. Make sure that user has permissions on the folder that contains the site.
Xequence
Contributor
4516 Points
1575 Posts
Re: Css and Scripts don't work until the user log in the website - Asp.NET MVC 3 Web Site
Jan 21, 2013 02:30 AM|LINK
your post helped me out with having different identities on anonymous authentication using IUSR instead of the application pool
Credentials