TagPrefixInfo Class


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Defines a configuration element containing tag-related information.

Namespace:   System.Web.Configuration
Assembly:  System.Web (in System.Web.dll)


public ref class TagPrefixInfo sealed : ConfigurationElement

System_CAPS_pubmethodTagPrefixInfo(String^, String^, String^, String^, String^)

Initializes a new instance of the TagPrefixInfo class using the passed values.


Gets or sets the name of the assembly containing the control implementation.


Gets a reference to the top-level Configuration instance that represents the configuration hierarchy that the current ConfigurationElement instance belongs to.(Inherited from ConfigurationElement.)


Gets an ElementInformation object that contains the non-customizable information and functionality of the ConfigurationElement object. (Inherited from ConfigurationElement.)


Gets the ConfigurationElementProperty object that represents the ConfigurationElement object itself.(Inherited from ConfigurationElement.)


Gets or sets a property or attribute of this configuration element.(Inherited from ConfigurationElement.)


Gets or sets a property, attribute, or child element of this configuration element.(Inherited from ConfigurationElement.)


Gets the collection of locked attributes.(Inherited from ConfigurationElement.)


Gets the collection of locked elements.(Inherited from ConfigurationElement.)


Gets the collection of locked attributes (Inherited from ConfigurationElement.)


Gets the collection of locked elements.(Inherited from ConfigurationElement.)


Gets or sets a value indicating whether the element is locked.(Inherited from ConfigurationElement.)


Gets or sets the namespace in which the control resides.


Gets the collection of properties.(Inherited from ConfigurationElement.)


Gets or sets the name and path of the file containing the user control.


Gets or sets the name of the user control.


Gets or sets the tag prefix that is being associated with a source file or namespace and assembly.

System_CAPS_protmethodDeserializeElement(XmlReader^, Boolean)

Reads XML from the configuration file.(Inherited from ConfigurationElement.)


Compares this instance to another object.(Overrides ConfigurationElement::Equals(Object^).)


Returns a hash value for the current instance.(Overrides ConfigurationElement::GetHashCode().)


Gets the Type of the current instance.(Inherited from Object.)


Sets the ConfigurationElement object to its initial state.(Inherited from ConfigurationElement.)


Used to initialize a default set of values for the ConfigurationElement object.(Inherited from ConfigurationElement.)


Indicates whether this configuration element has been modified since it was last saved or loaded, when implemented in a derived class.(Inherited from ConfigurationElement.)


Gets a value indicating whether the ConfigurationElement object is read-only.(Inherited from ConfigurationElement.)


Resets the internal state of the ConfigurationElement object, including the locks and the properties collections.(Inherited from ConfigurationElement.)


Resets the value of the IsModified method to false when implemented in a derived class.(Inherited from ConfigurationElement.)

System_CAPS_protmethodSerializeElement(XmlWriter^, Boolean)

Writes the contents of this configuration element to the configuration file when implemented in a derived class.(Inherited from ConfigurationElement.)

System_CAPS_protmethodSerializeToXmlElement(XmlWriter^, String^)

Writes the outer tags of this configuration element to the configuration file when implemented in a derived class.(Inherited from ConfigurationElement.)


Sets the IsReadOnly property for the ConfigurationElement object and all subelements.(Inherited from ConfigurationElement.)


Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_protmethodUnmerge(ConfigurationElement^, ConfigurationElement^, ConfigurationSaveMode)

Modifies the ConfigurationElement object to remove all values that should not be saved. (Inherited from ConfigurationElement.)

The TagPrefixInfo class allows you to programmatically access and modify tag-prefix information stored in a configuration file. It provides the same functionality as the ASP.NET @Register directive. Tag prefixes associate a "namespace" in ASP.NET to the assemblies and namespaces that must be included for custom controls and user controls to work properly. TagPrefixInfo objects are stored as members of a TagPrefixCollection object. The TagPrefixCollection class allows you to programmatically access and modify the controls subsection of the pages section of a configuration file.

TagPrefixInfo objects are added to the collection using the add element and specifying a value for the tagPrefix attribute along with values for other relevant attributes. The other required information varies based on the kind of control you will use with the specified tag prefix:

The same tagPrefix value can be used to map to multiple assemblies or namespaces.


When a source is specified, the user control itself must not be in the same directory as the page. If it is, you get a run-time error when you attempt to load the page.

This example demonstrates how to specify values declaratively for several attributes of the controls section, which can also be accessed as members of the TagPrefixInfo class.

      <!—- Searches all linked assemblies for the namespace -->
      <add tagPrefix="MyTags1" namespace=" MyNameSpace "/>
      <!-- Uses a specified assembly -->
      <add tagPrefix="MyTags2" namespace="MyNameSpace" 
      <!-- Uses the specified source for the user control -->
      <add tagprefix="MyTags3" tagname="MyCtrl" src="MyControl.ascx"/>

The following code example shows how to use the TagPrefixInfo class to programmatically modify tag prefix settings. This code example is part of a larger example provided for the PagesSection class.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top