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
- 繼承
- 屬性
範例
以下程式碼範例說明如何從現有網頁應用程式的設定檔取得該 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 區段元素集合中的 UrlMappingsSection 元素。
建構函式
| 名稱 | Description |
|---|---|
| UrlMappingCollection() |
初始化 UrlMappingCollection 類別的新執行個體。 |
屬性
方法
明確介面實作
| 名稱 | Description |
|---|---|
| ICollection.CopyTo(Array, Int32) |
將 ConfigurationElementCollection 複製到陣列。 (繼承來源 ConfigurationElementCollection) |
擴充方法
| 名稱 | Description |
|---|---|
| AsParallel(IEnumerable) |
啟用查詢的平行處理。 |
| AsQueryable(IEnumerable) |
將 IEnumerable 轉換成 IQueryable。 |
| Cast<TResult>(IEnumerable) |
將 IEnumerable 的項目轉換成指定的型別。 |
| OfType<TResult>(IEnumerable) |
根據指定的型別篩選 IEnumerable 的專案。 |