VirtualDirectoryCollection 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示特定应用程序或站点上下文的虚拟目录的集合。
public ref class VirtualDirectoryCollection sealed : Microsoft::Web::Administration::ConfigurationElementCollectionBase<Microsoft::Web::Administration::VirtualDirectory ^>
public sealed class VirtualDirectoryCollection : Microsoft.Web.Administration.ConfigurationElementCollectionBase<Microsoft.Web.Administration.VirtualDirectory>
type VirtualDirectoryCollection = class
inherit ConfigurationElementCollectionBase<VirtualDirectory>
Public NotInheritable Class VirtualDirectoryCollection
Inherits ConfigurationElementCollectionBase(Of VirtualDirectory)
- 继承
-
VirtualDirectoryCollection
示例
以下示例显示与默认网站关联的每个应用程序下的所有虚拟目录。
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 AdministrationVirtualDirectoryCollection
{
public void GetAllVirtualDirectories()
{
ServerManager manager = new ServerManager();
Site defaultSite = manager.Sites["Default Web Site"];
foreach (Application app in defaultSite.Applications)
{
Console.WriteLine("Found application with the following path: {0}", app.Path);
Console.WriteLine("Virtual Directories:");
if (app.VirtualDirectories.Count > 0)
{
foreach (VirtualDirectory vdir in app.VirtualDirectories)
{
Console.WriteLine(" Virtual Directory: {0}", vdir.Path);
Console.WriteLine(" |-PhysicalPath = {0}", vdir.PhysicalPath);
Console.WriteLine(" |-LogonMethod = {0}", vdir.LogonMethod);
Console.WriteLine(" +-UserName = {0}\r\n", vdir.UserName);
}
}
}
}
}
}
注解
此类是密封的,不实现公共构造函数。 可以通过 对象的 属性Application访问 VirtualDirectoryCollection 类<xref:Microsoft.Web.Administration.Site.VirtualDirectories%2A>。
属性
AllowsAdd |
获取一个值,该值指示元素名称是否 |
AllowsClear |
获取一个值,该值指示是否 |
AllowsRemove |
获取一个值,该值指示是否 |
Attributes |
获取包含此元素的属性列表的配置属性集合。 (继承自 ConfigurationElement) |
ChildElements |
获取当前元素的所有子元素。 (继承自 ConfigurationElement) |
Count |
获取集合中的项数。 (继承自 ConfigurationElementCollectionBase<T>) |
ElementTagName |
表示特定应用程序或站点上下文的虚拟目录的集合。 (继承自 ConfigurationElement) |
IsLocallyStored |
获取一个值,该值指示配置元素是否存储在特定的配置文件中。 (继承自 ConfigurationElement) |
Item[Int32] |
获取指定索引处的配置元素。 (继承自 ConfigurationElementCollectionBase<T>) |
Item[String] |
获取集合中具有指定键的虚拟目录。 |
Methods |
获取配置元素的方法集合。 (继承自 ConfigurationElement) |
RawAttributes |
表示特定应用程序或站点上下文的虚拟目录的集合。 (继承自 ConfigurationElement) |
Schema |
获取描述配置元素集合的架构。 (继承自 ConfigurationElementCollectionBase<T>) |
方法
显式接口实现
ICollection.CopyTo(Array, Int32) |
从特定的数组索引开始,将集合的元素复制到数组中。 (继承自 ConfigurationElementCollectionBase<T>) |
ICollection.Count |
表示特定应用程序或站点上下文的虚拟目录的集合。 (继承自 ConfigurationElementCollectionBase<T>) |
ICollection.IsSynchronized |
表示特定应用程序或站点上下文的虚拟目录的集合。 (继承自 ConfigurationElementCollectionBase<T>) |
ICollection.SyncRoot |
表示特定应用程序或站点上下文的虚拟目录的集合。 (继承自 ConfigurationElementCollectionBase<T>) |
IEnumerable.GetEnumerator() |
返回一个循环访问集合的枚举器。 (继承自 ConfigurationElementCollectionBase<T>) |