locked
httpErrors is not working in windows server RRS feed

  • Question

  • User-1045082127 posted

    hi every body .

    I use this code snipped for prevent access to the files (root ) , sub folders and  files. every thin is okay in locally place but when i published the web config file. it not working at all

    please help me.

      <location path="Files">
        <system.webServer   >
          <httpErrors errorMode="Custom" existingResponse="Replace">
            <remove statusCode="401"/>
            <error statusCode="401" path="/PermissionDenied.html" responseMode="Redirect"/>
          </httpErrors>
          <security  >
            <authorization  >
              <add accessType="Deny" users="?"  />
            </authorization>
          </security>
        </system.webServer>
      </location>

    Saturday, August 3, 2019 5:42 AM

All replies

  • User1520731567 posted

    Hi aminsoraya,

    every thin is okay in locally place but when i published the web config file. it not working at all

    Since the <httpErrors> element was introduced in IIS 7.0,so I suggest you need to pay attention to your the version of IIS and using IIS7+.

    And make sure HTTP errors is enabled in IIS,like the picture:

    If there is no such icon,please set it enable in windows features,like the picture:

    I have test and work well based on your code both in local and publishing environment.

    You could also try to add httpErrors by setting Error Pages in IIS,more details,please refer to:

    https://docs.microsoft.com/en-us/iis/configuration/system.webserver/httperrors/error

    Best Regards.

    Yuki Tao

    Monday, August 5, 2019 5:29 AM