Error “You do not have permission to view this directory or page” in Azure

There can be different reasons of that error. In my case this was lack of Global.asax file for ASP.NET application. To create this file on deploying application uncheck the flag “Precompile during publishing” in publish wizard.

Uncheck flag "Precompile during publishing" in publish wizard
Uncheck flag “Precompile during publishing” in publish wizard.

How to add custom configuration attributes to ASP.NET application


Add configuration attributes to Web.config file.


    <add key="UIVisible" value="false"/>
    <add key="MonitoringIntervalMs" value="1000"/>
    <add key="MonitoringDisabled" value="true"/>

Alternatively it’s possible to use Azure application attributes.

Reading from local Web.config

var appSettings = 
    (NameValueCollection) ConfigurationManager.GetSection("appSettings");
UiVisible = bool.Parse(appSettings["UIVisible"]);
MonitoringIntervalMs = int.Parse(appSettings["MonitoringIntervalMs"]);
MonitoringDisabled = bool.Parse(appSettings["MonitoringDisabled"]);

Reading from Azure

UiVisible = bool.Parse(CloudConfigurationManager.GetSetting("UIVisible"))