ClientTarget 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
ASP.NET 서버 컨트롤이 콘텐츠를 렌더링해야 하는 대상 사용자 에이전트와 연결된 별칭을 정의합니다. 이 클래스는 상속할 수 없습니다.
public ref class ClientTarget sealed : System::Configuration::ConfigurationElement
public sealed class ClientTarget : System.Configuration.ConfigurationElement
type ClientTarget = class
inherit ConfigurationElement
Public NotInheritable Class ClientTarget
Inherits ConfigurationElement
- 상속
예제
이 섹션에서는 두 가지 코드 예제를 제공합니다. 첫 번째는 클래스의 여러 속성에 대한 값을 선언적으로 지정하는 방법을 보여 줍니다 ClientTarget . 두 번째는 구성 파일에서 개체를 ClientTargetCollection 가져오는 방법을 보여줍니다. 이 개체를 사용하여 포함된 개체에 ClientTarget 액세스합니다.
다음 코드 예제에서는 선언적으로 클래스의 여러 속성에 대 한 값을 지정 하는 방법을 보여 있습니다 ClientTarget .
<clientTarget>
<add alias=
"uplevel"
userAgent="Mozilla/5.0 (compatible;MSIE 6.0;Windows NT 5.1)"/>
<add alias="downlevel" userAgent="Generic Downlevel"/>
</clientTarget>
다음 코드 예제에서는 구성 파일에서 개체를 ClientTargetCollection 가져오는 방법을 보여줍니다.
// Get the Web application configuration.
System.Configuration.Configuration configuration =
WebConfigurationManager.OpenWebConfiguration(
"/aspnetTest");
// Get the <clientTarget> section.
ClientTargetSection clientTargetSection =
(ClientTargetSection)configuration.GetSection(
"system.web/clientTarget");
// Get the client target collection.
ClientTargetCollection clientTargets =
clientTargetSection.ClientTargets;
' Get the Web application configuration.
Dim configuration _
As System.Configuration.Configuration = _
WebConfigurationManager.OpenWebConfiguration( _
"/aspnetTest")
' Get the <clientTarget> section.
Dim clientTargetSection _
As ClientTargetSection = _
CType(configuration.GetSection( _
"system.web/clientTarget"), _
ClientTargetSection)
' Get the client target collection.
Dim clientTargets _
As ClientTargetCollection = _
clientTargetSection.ClientTargets
설명
클래스는 ClientTarget 구성 파일의 섹션에 clientTarget 추가되는 요소를 참조합니다.
클래스는 ClientTarget 클래스와 클래스를 ClientTargetCollection 포함하는 그룹에 속합니다 ClientTargetSection .
클래스에는 ClientTarget 클라이언트 브라우저를 식별하는 두 개의 속성(사용자 에이전트라고도 합니다)이 포함됩니다. 한 속성은 두 번째 속성으로 식별되는 클라이언트 브라우저와 연결된 별칭입니다. ASP.NET 이 정보를 사용하여 페이지에서 서버 컨트롤을 렌더링합니다.
사용자 에이전트 또는 해당 별칭을 프로그래밍 방식으로 사용하는 방법에 대한 자세한 내용은 속성을 참조 Page.ClientTarget 하세요. 사용자 에이전트 또는 해당 별칭을 선언적으로 사용하는 방법에 대한 자세한 내용은 @ 페이지를 참조하세요.
속성이 Page.ClientTarget 설정 HttpBrowserCapabilities 되지 않은 경우 속성과 Page.Request 연결된 개체는 클라이언트 브라우저의 기능을 반영합니다. (브라우저 유형의 기능을 반영하지만 해당 브라우저의 특정 인스턴스에서 설정이 반드시 반영되지는 않습니다.) 속성이 설정되면 클라이언트 브라우저 검색이 비활성화되고 페이지에서 정의한 사용자 에이전트 문자열과 연결된 브라우저 기능을 사용합니다. 이 속성을 유효한 사용자 에이전트 문자열로 설정할 수 있습니다.
생성자
| Name | Description |
|---|---|
| ClientTarget(String, String) |
ClientTarget 클래스의 새 인스턴스를 초기화합니다. |