다음을 통해 공유


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 포함되어서는 안 됩니다. 메서드의 매개 변수를 사용하여 path 이 속성의 Add 값을 설정할 수도 있습니다.

적용 대상