2017-02-15 9 views
1

を通じて公開フォルダにアクセスするとき私たちは以下のようにIIS 7.0を通じてフォルダを公表否定し、我々はブラウザを介して以下のようにファイルにアクセスする場合、それに403 - 禁止:アクセスは、私たちは、IIS 7.0

https://www.example.net/mydocs 

をいくつかのファイルを入れています今、私たちは、このフォルダにファイルをダウンロードし、アップロードするPGMを記述する必要があり、我々は

0以下のようにコード化された。..

https://www.example.net/mydocs/client.xml 
https://www.example.net/mydocs/log.jpg 

などに

それを見ることができます

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); 
      } 

しかし、それは我々がブラウザを介して

https://www.example.net/mydocs 

にアクセスしようとした場合、我々はあなたがする必要があるエラーに

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

+0

IISからディレクトリブラウズを許可する必要があります。 – Mairaj

答えて

1

を取得している。またserverResponse = serverRequest.GetResponse();

The error is The remote server returned an error: (403) Forbidden.

で投げるとエラーIISからのディレクトリブラウズを許可する。次の手順に従って、ディレクトリブラウズを許可します。

  • オープンIIS
  • 左ペインからあなたのウェブサイトを選択してください。
  • 右ペインのDirectory Browsingをダブルクリックします。
  • 右ペインにActionsをクリックしてください。Enableをクリックしてください。
0

IISでディレクトリブラウズを有効にする必要があります。そうしないと、ファイルにフルパスでアクセスできます。 Refer this link will show how

関連する問題