Categories
IIS

IIS won’t show CSS, Javascript (JS) and logs say 302?

I uploaded created a new IIS site on a Windows Server 2008 R2 box running IIS 7.5.
I created an Application Pool for this site using an Identity of NetworkService.
I created the site with Connect As “Application user (pass-through) authentication” in the Edit site section and set it to the new application pool.
I set the permissions correctly on the files using Windows Explorer.
I had some other sites on this server which were working properly.

At this point I noticed that none of the CSS or Javascript (JS) content was loading. I checked the server logs and the failing pages were receiving 302 HTTP redirect codes instead of serving the content with a HTTP 200 code.

A quick Google search and I didn’t really find a solution. The problem wasn’t resolved using location path in web.config to set authorisation for all users. The permissions were all correct, they were set exactly the same as a similar site on the same server which was working. Another suggestion that “Static Content” was not installed wasn’t the answer.

The solution was simple. Using Features View in IIS Manager, double clicking on the Authentication Entry under IIS, selecting “Anonymous Authentication”, choosing Edit and changing the setting to “Application pool identity” – Obvious.