Export (0) Print
Expand All

SetAttributeValue Method

IIS 7.0

Sets the value of the specified attribute.

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

public void SetAttributeValue(
	string attributeName,
	Object value
)

Parameters

attributeName
Type: System..::..String
The name of the attribute to change.
value
Type: System..::..Object
The new value of the attribute.

ExceptionCondition
ArgumentNullException

The attributeName parameter is nullNothingnullptrunita null reference (Nothing in Visual Basic) or empty.

This method sets the attribute value and writes it to the Administration.config file. The Administration.config file is not modified until the CommitChanges method is called.

You can also set the attribute value by using the Item or Value properties. For best system performance, you should use the SetAttributeValue method.

The following example modifies the element with the name "TestDemo". The value is modified to "TestDemo(modified)".

// Use any of the following lines to set the attribute value.
// attribute.Value = "TestDemo(Modified)";
moduleproviderelement.SetAttributeValue(
    "name", "TestDemo(Modified)");
// moduleproviderelement["name"] = "TestDemo(Modified)";


Community Additions

ADD
Show:
© 2015 Microsoft