asp.net.ph

ClientTargetSection Class

System.Web.Configuration Namespace


.NET Framework version 2.0

Provides programmatic access to the clientTarget configuration file section. This class cannot be inherited.

ClientTargetSection Class Members

Collapse   Constructors

Visibility Constructor Parameters
public ClientTargetSection ( )

Collapse   Properties

Visibility Name Value Type Accessibility
public ClientTargets ClientTargetCollection [ Get ]

Remarks

The ClientTargetSection class provides a way to programmatically access and modify the clientTarget section of a configuration file.

This type is part of a group that includes the ClientTarget and ClientTargetCollection types.

The ClientTargetSection class contains ClientTarget objects that define pairs of aliases and associated target user agents for which ASP.NET server controls should render content.

NOTE: The ClientTargetSection can read and write information from and to the related section of the configuration file according to the section property AllowDefinition whose value is Everywhere.

Example

This section provides two code examples. The first displays a declarative representation of the ClientTargetSection class and also demonstrates how to declaratively specify values for several properties of the ClientTarget class. The second shows how to obtain the ClientTargetCollection object from the configuration file. You use this object to access the ClientTarget objects it contains.

The following code example shows how to declaratively specify values for several properties of the ClientTarget class.

<clientTarget>
   <add alias = 
      "ie5" userAgent = "Mozilla/4.0 ( compatible;MSIE 5.5;Windows NT 4.0 )" />
   <add alias = 
      "ie4" userAgent = "Mozilla/4.0 ( compatible;MSIE 4.0;Windows NT 4.0 )" />
   <add alias = 
      "uplevel" userAgent = "Mozilla/4.0 ( compatible;MSIE 4.0;Windows NT 4.0 )" />
   <add alias = "downlevel" userAgent = "Unknown" />
</clientTarget>

The following code example shows how to obtain the ClientTargetCollection object from the configuration file

// 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;
  C# VB

See Also

ASP.NET Configuration   <clientTarget> Section   ClientTarget Class   ClientTargetCollection Class Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph