Share via


VirtualDirectory.PhysicalPath Eigenschaft

Definition

Ruft den physischen Speicherort des zu verwendenden virtuellen Verzeichnisses ab oder legt diesen fest.

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

Eigenschaftswert

Der physische Speicherortpfad, dem das virtuelle Verzeichnis zugeordnet ist.

Beispiele

Im folgenden Beispiel wird veranschaulicht, wie die PhysicalPath -Eigenschaft eines virtuellen Verzeichnisses festgelegt wird.


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

Hinweise

Dieser Pfad kann ein UNC-Pfad sein. Anmeldeinformationen sind jedoch erforderlich, wenn Sie die Verwaltung dieses Verzeichnisses an einen Benutzer delegieren, der nicht Mitglied der lokalen Administratorgruppe auf dem Webserver ist.

Gilt für: