ConfigurationElement.GetAttributeValue Method (String)

IIS 7.0

Returns the value of the specified attribute.

Namespace:   Microsoft.Web.Administration
Assembly:  Microsoft.Web.Administration (in Microsoft.Web.Administration.dll)

public object GetAttributeValue(
	string attributeName


Type: System.String

The name of the requested attribute.

Return Value

Type: System.Object

An object that represents the requested attribute, if it exists; otherwise, null.

Exception Condition

The attributeName parameter is null or empty.

If the name of the requested attribute is not in the value of the RawAttributes property, this method returns null.

You can also get the attribute value by using the Item property or the ConfigurationAttribute.Value property. GetAttributeValue is the preferred method.

The following example gets the attribute value.

// Use any of the following lines to retrieve the attribute value.
// attributeBag[ConfigurationDemoGlobals.AttributeName] = "name";
attributeBag[ConfigurationDemoGlobals.AttributeName] =
// attributeBag[ConfigurationDemoGlobals.AttributeName] =
//    moduleproviderelement["name"];
Return to top