VirtualDirectory.Path Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient ou définit le chemin d’accès virtuel du répertoire virtuel par rapport à son parent.
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
Valeur de propriété
Chemin d’accès virtuel relatif du répertoire virtuel.
Exemples
L’exemple suivant montre comment définir la Path 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
Lorsque vous définissez cette propriété, le chemin d’accès ne doit contenir aucun caractère de la InvalidVirtualDirectoryPathCharacters propriété de la VirtualDirectoryCollection classe . Vous pouvez également définir la valeur de cette propriété à l’aide du path
paramètre de la Add méthode .