次の方法で共有


VirtualDirectory.Path プロパティ

定義

親を基準とした仮想ディレクトリの仮想パスを取得または設定します。

public:
 property System::String ^ Path { System::String ^ get(); void set(System::String ^ value); };
public string Path { get; set; }
member this.Path : string with get, set
Public Property Path As String

プロパティ値

仮想ディレクトリの相対仮想パス。

次の例では、仮想ディレクトリの プロパティを Path 設定する方法を示します。


using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Web.Administration;
using Microsoft.Web.Management;
using Microsoft.Web.Management.Client;

namespace AdministrationSnippets
{
    public class AdministrationVirtualDirectory
    {
        // Creates a new virtual directory, retrieves the configuration,
        // then changes the Path and PhysicalPath
        public void SetPathAndPhysicalPath()
        {
            // Create a new application and update the configuration system
            ServerManager manager = new ServerManager();
            Site defaultSite = manager.Sites["Default Web Site"];
            Application reports =
                defaultSite.Applications.Add("/reports", @"C:\inetpub\reports");
            manager.CommitChanges();
            
            
            // Read the data back from the updated configuration system, 
            // then modify the Path and Physical Path.
            reports = manager.Sites["Default Web Site"].Applications["/reports"];
            VirtualDirectory reportDir = reports.VirtualDirectories[0];
            reportDir.Path = "/private_reports";
            reportDir.PhysicalPath = @"C:\inetpub\secure\reports";
            manager.CommitChanges();
        }
    }
}

注釈

このプロパティを設定する場合、パスには クラスの VirtualDirectoryCollection プロパティの文字をInvalidVirtualDirectoryPathCharacters含めてはいけません。 メソッドの パラメーターを使用して、このプロパティの値をpathAdd設定することもできます。

適用対象