UrlMappingsSection クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
urlMappings構成セクションへのプログラムによるアクセスを提供します。 このクラスは継承できません。
public ref class UrlMappingsSection sealed : System::Configuration::ConfigurationSection
public sealed class UrlMappingsSection : System.Configuration.ConfigurationSection
type UrlMappingsSection = class
inherit ConfigurationSection
Public NotInheritable Class UrlMappingsSection
Inherits ConfigurationSection
- 継承
例
次のコード例は、既存の Web アプリケーションの構成ファイルから UrlMappingsSection オブジェクトを取得する方法を示しています。 構成ファイルの抜粋も示します。
// 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
<urlMappings enabled="true">
<add url= "~/home.aspx"
mappedUrl="~/default.aspx?parm1=1"/>
<add url= "~/products.aspx"
mappedUrl="~/default.aspx?parm1=2"/>
</urlMappings>
注釈
UrlMappingsSection クラスは、構成ファイルの urlMappings セクションにプログラムでアクセスして変更する方法を提供します。
Note
urlMappings セクションには、ユーザーに表示される URL を Web アプリケーションに存在する URL にマップするUrlMapping オブジェクトが含まれています。
UrlMappingsSectionは、値がAllowDefinitionセクション プロパティMachineToApplicationで定義されている制限に従って、構成ファイルの関連セクションに情報を書き込むことができます。 階層内で許可されていないレベルで構成ファイルに書き込もうとすると、パーサーによってエラー メッセージが生成されます。 ただし、このクラスを使用して、階層内の任意のレベルで構成情報を読み取ることができます。
コンストラクター
| 名前 | 説明 |
|---|---|
| UrlMappingsSection() |
UrlMappingsSection クラスの新しいインスタンスを初期化します。 |