sreein1986 0 Posting Whiz

Hi I designed I asp application but when i put in my localhost it shows error like "You need to disable anonymous access for this code to work."

pls resolve it

Dani AI

Generated

For : that message usually means the application expects a Windows-authenticated identity (for example it reads LOGON_USER, uses impersonation, or performs Active Directory lookups) but IIS is allowing anonymous requests. The immediate fix is to disable Anonymous Authentication for the site and enable a Windows-based authentication method so the code can see a real user token.

On IIS 7+:
Open IIS Manager, select the site or application, double-click Authentication, disable "Anonymous Authentication" and enable "Windows Authentication". If "Windows Authentication" is not listed, install the IIS Windows Authentication feature. On IIS 6: open the website properties, go to Directory Security, click Edit and turn off anonymous access and enable Integrated Windows authentication. Restart the site after changes.

A typical web.config pair to match IIS settings (system.web and system.webServer) looks like this:

<system.web>
  <authentication mode="Windows" />
  <identity impersonate="true" />
  <authorization>
    <deny users="?" />
  </authorization>
</system.web>

<system.webServer>
  <security>
    <authentication>
      <anonymousAuthentication enabled="false" />
      <windowsAuthentication enabled="true" />
    </authentication>
  </security>
</system.webServer>

Notes and troubleshooting: the Visual Studio built-in server (Cassini) does not support Windows Authentication—use IIS Express or local IIS for testing. Ensure NTFS permissions and the app pool identity are appropriate if impersonation is used. Browsers may require configuration for integrated auth (Firefox needs trusted-uris set). For official guidance see Microsoft documentation on configuring IIS authentication: and Windows Authentication configuration.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.