Condividi tramite


VirtualDirectory.PhysicalPath Proprietà

Definizione

Ottiene o imposta la posizione fisica della directory virtuale da utilizzare.

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

Valore della proprietà

Percorso fisico di cui viene eseguito il mapping della directory virtuale.

Esempio

Nell'esempio seguente viene illustrato come impostare la PhysicalPath proprietà di una directory virtuale.


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

Commenti

Questo percorso può essere un percorso UNC. Tuttavia, le credenziali sono necessarie se si delega l'amministrazione di questa directory a un utente che non è membro del gruppo Administrators locale nel server Web.

Si applica a