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();
}
}
}
Комментарии
При установке этого свойства путь не должен содержать символы из InvalidVirtualDirectoryPathCharacters свойства VirtualDirectoryCollection класса . Можно также задать значение этого свойства с помощью path параметра Add метода .