UrlMappingCollection 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示 UrlMapping 对象集合。 此类不能被继承。
public ref class UrlMappingCollection sealed : System::Configuration::ConfigurationElementCollection
[System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.UrlMapping))]
public sealed class UrlMappingCollection : System.Configuration.ConfigurationElementCollection
[<System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.UrlMapping))>]
type UrlMappingCollection = class
inherit ConfigurationElementCollection
Public NotInheritable Class UrlMappingCollection
Inherits ConfigurationElementCollection
- 继承
- 属性
示例
下面的代码示例演示如何从现有 Web 应用程序的配置文件中获取 UrlMappingCollection 对象。 此外,还显示了配置文件的摘录。
<urlMappings enabled="true">
<add url= "~/home.aspx"
mappedUrl="~/default.aspx?parm1=1"/>
<add url= "~/products.aspx"
mappedUrl="~/default.aspx?parm1=2"/>
</urlMappings>
// Get the Web application configuration.
System.Configuration.Configuration configuration =
WebConfigurationManager.OpenWebConfiguration(
"/aspnetTest");
// Get the <urlMapping> section.
UrlMappingsSection urlMappingSection =
(UrlMappingsSection)configuration.GetSection(
"system.web/urlMappings");
// Get the url mapping collection.
UrlMappingCollection urlMappings =
urlMappingSection.UrlMappings;
' Get the Web application configuration.
Dim configuration _
As System.Configuration.Configuration = _
WebConfigurationManager.OpenWebConfiguration( _
"/aspnetTest")
' Get the <urlMapping> section.
Dim urlMappingSection _
As UrlMappingsSection = _
CType(configuration.GetSection( _
"system.web/urlMappings"), UrlMappingsSection)
' Get the url mapping collection.
Dim urlMappings _
As UrlMappingCollection = _
urlMappingSection.UrlMappings
注解
类型 UrlMappingCollection 允许访问 UrlMappings section 元素集合的 UrlMappingsSection 元素。
构造函数
| UrlMappingCollection() |
初始化 UrlMappingCollection 类的新实例。 |
属性
方法
显式接口实现
| ICollection.CopyTo(Array, Int32) |
将 ConfigurationElementCollection 复制到数组。 (继承自 ConfigurationElementCollection) |
扩展方法
| Cast<TResult>(IEnumerable) |
将 IEnumerable 的元素强制转换为指定的类型。 |
| OfType<TResult>(IEnumerable) |
根据指定类型筛选 IEnumerable 的元素。 |
| AsParallel(IEnumerable) |
启用查询的并行化。 |
| AsQueryable(IEnumerable) |
将 IEnumerable 转换为 IQueryable。 |