0

I was working on web app to get IP and username and for test I use this code in the visual studio in a web app's web.config file,

<system.web>
   ...
   <authentication mode="Windows"/>
   <identity impersonate="true"/>
   ...
</system.web>

and then IIS stopped to show images, css and js files even I've remove and again add IIS to the system. All published sites even IIS default site didn't show its image, see image1. image1 The said configured app and other apps work on web server even IIS Express of Visual Studio but not work on Localhost.

The browser in the status bar shows Waiting for static.antp.co...

1 Answers1

0

The reason for this problem is you added windows authentication in web.config file. On local machine, your windows credentials are automatically passed so it can work as expected. But if you run the application on IIS on localhost, you are treated as an anonymous user.

To solve this problem, you can remove the line <authentication mode="Windows"/> if you do not need windows authentication. Or add a web.config in the directory(s) containing CSS, images, scripts, etc. which specifies authorization rules.

Hury Shen
  • 14,948
  • 1
  • 9
  • 18
  • Already try this method but not worked. Even I removed that app from IIS and this also not work. – AEC Production Aug 26 '21 at 16:09
  • [Here](https://stackoverflow.com/questions/10512053/css-images-js-not-loading-in-iis) is a post which contains multiple solutions for different causes of this problem. Please take a look and try with the solutions in it. – Hury Shen Aug 27 '21 at 07:32
  • Already tried this post. What if I removed all web apps exclude IIS default site and same problem? I'm just talking about, this is IIS problem not any app. Because if an app do this then after remove it its should be work but it's not. – AEC Production Aug 28 '21 at 14:35