VirtualDirectory.PhysicalPath Свойство
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Возвращает или задает физическое расположение используемого виртуального каталога.
public:
property System::String ^ PhysicalPath { System::String ^ get(); void set(System::String ^ value); };
public string PhysicalPath { get; set; }
member this.PhysicalPath : string with get, set
Public Property PhysicalPath As String
Значение свойства
Путь к физическому расположению, для которого сопоставляется виртуальный каталог.
Примеры
В следующем примере показано, как задать PhysicalPath свойство виртуального каталога.
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();
}
}
}
Комментарии
Этот путь может быть UNC-путем. Однако учетные данные необходимы, если вы делегируете администрирование этого каталога пользователю, не являющемуся членом локальной группы администраторов на веб-сервере.