title: IIS - 403 Forbidden: Access is denied when accessing a folder published through IIS 7.0
body: <p>We published a folder through IIS 7.0 as below and put some files in it</p>
  
  <pre><code>https://www.example.net/mydocs
  </code></pre>
  
  <p>If we access the files as below through browser we are able to see it</p>
  
  <pre><code>https://www.example.net/mydocs/client.xml
  https://www.example.net/mydocs/log.jpg
  </code></pre>
  
  <p>etc..</p>
  
  <p>Now we need to write a pgm to download and upload files to this folder and we coded as below</p>
  
  <pre><code>WebClient webClient = new WebClient();
              string webAddress = null;
              try
              {
                  webAddress = @"https://www.example.net/mydocs";
                  webClient.UseDefaultCredentials = true;
                  webClient.Credentials = CredentialCache.DefaultCredentials;
  
                  WebRequest serverRequest = WebRequest.Create(webAddress);
                  WebResponse serverResponse;
                  serverResponse = serverRequest.GetResponse();
                  serverResponse.Close();
  
                  webClient.UploadFile(webAddress + @"1.xml", "PUT", @"C:\d\1.xml");
                  webClient.Dispose();
                  webClient = null;
              }
              catch (Exception error)
              {
                  MessageBox.Show(error.Message);
              }
  </code></pre>
  
  <p>But it throwing and error at <code>serverResponse = serverRequest.GetResponse();</code></p>
  
  <blockquote>
    <p>The error is The remote server returned an error: (403) Forbidden.</p>
  </blockquote>
  
  <p>Also if we try to access </p>
  
  <pre><code>https://www.example.net/mydocs
  </code></pre>
  
  <p>through browser we are getting the error</p>
  
  <blockquote>
    <p>403 - Forbidden: Access is denied. You do not have permission to view
    this directory or page using the credentials that you supplied. when
    accessing the folder published through iis</p>
  </blockquote>