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
- 상속
예제
다음 코드 예제에서는 기존 웹 애플리케이션의 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 수정 하는 방법을 제공 합니다.
메모
이 urlMappings 섹션에는 사용자에게 표시되는 URL을 웹 애플리케이션에 있는 URL에 매핑하는 개체가 포함되어 UrlMapping 있습니다. 값 UrlMappingsSection 이 있는 섹션 속성 AllowDefinition 에 정의된 제한 사항에 따라 구성 파일의 관련 섹션에 정보를 쓸 수 있습니다 MachineToApplication. 계층 구조에서 허용되지 않는 수준에서 구성 파일에 쓰려고 하면 파서에서 오류 메시지가 생성됩니다. 그러나 이 클래스를 사용하여 계층 구조의 모든 수준에서 구성 정보를 읽을 수 있습니다.
생성자
| Name | Description |
|---|---|
| UrlMappingsSection() |
UrlMappingsSection 클래스의 새 인스턴스를 초기화합니다. |