Correcting the "You do not have permission to view this directory or page." issue.

Wanna Learn Quickly 20 Reputation points
2023-10-23T19:15:13.1133333+00:00

I asked the azure help system about my problem and it gave me an automated answer. But I am new to Azure and I would like directions as to how to perform the tasks it gave me. Why does my azure web site I created, https://nicholasair.azurewebsites.net/ say "You do not have permission to view this directory or page." And the online azure help system said:

The below answer may help you

This error usually occurs when the permissions for the website are not set correctly. To resolve this issue, please check the following:

  1. Ensure that the website is configured to use the correct user identity.
  2. Check the folder and file permissions for the website.
  3. Check the application pool identity for the website.
  4. Check the IIS settings for the website.
  5. Check the web.config file for the website.

Please help by explaining how to do the steps.

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,178 questions
{count} votes

1 answer

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 22,706 Reputation points Moderator
    2023-10-26T06:28:22.8166667+00:00

    @Wanna Learn Quickly

    Thank you for your presence here!

    You do not have permission to view this directory or page.

    When Azure encounters an error while running your web app, error message

    • First, ensure that your web app's WAR file has been correctly unpacked inside the "webapps" folder. To verify this, go to the SCM (KUDU) interface. If your web URL is "xyz.azurewebsites.net," try opening "xyz.scm.azurewebsites.net."
    • In the KUDU interface, select the "Debug Console" from the available tabs and then choose "CMD" from the drop-down menu. This will provide you with access to the folder structure. Navigate to "site" -> "wwwroot" -> "webapps" to check if your WAR file has been unpacked.
    • Also try restarting the web app.
    • Additionally, ensure that your startup file (e.g., "index.html") is added to the default documents section. You can do this by going to the azure portal> your web app> settings>configuration> "Default documents" tab and adding the name of your main file (usually "index.html") if it's not already there.
    • Also,If you have IP restrictions configured in your IIS settings, check your Web.config file. Make sure to add your IP address to the security section, as shown below:
    <security>
      <ipSecurity allowUnlisted="false">
        <clear />
        <add ipAddress="192.168.250.70" allowed="true" />
      </ipSecurity>
    </security>
    

    You can remove this section if you don't want to restrict any IP addresses.

    • For detailed error messages, you can enable Azure diagnostics logging during troubleshooting and disable it when your web app is ready for production. Follow these steps:
    • Log in to Azure, navigate to "App Services" in the left-side menu, select your web app, and locate "App Service logs" (use the search box if needed). Turn on "Detailed Error Messages" or enable all the logging options, depending on your preference.
    • Add the following lines to your Web.config file:
    <customErrors mode="Off" /> <!-- Add this before </system.web> -->
    
    <httpErrors errorMode="Detailed"></httpErrors> <!-- Add this before </system.webServer> -->
    

    Let us know if further query or issue remains.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.