VirtualDirectory.PhysicalPath Propriété

Définition

Obtient ou définit l’emplacement physique du répertoire virtuel à utiliser.

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

Valeur de propriété

Chemin d’accès d’emplacement physique auquel le répertoire virtuel est mappé.

Exemples

L’exemple suivant montre comment définir la PhysicalPath propriété d’un répertoire virtuel.


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

Remarques

Ce chemin d’accès peut être un chemin UNC. Toutefois, des informations d’identification sont requises si vous déléguez l’administration de ce répertoire à un utilisateur qui n’est pas membre du groupe Administrateurs local sur le serveur web.

S’applique à