views:

16

answers:

0

Hello, Iam trying to work set a property value in the IIS 6.0 API and i am getting this security error: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) on this line: path.CommitChanges();

This is my code:

Function Test() '-- Dim metabasePath As String Dim propertyName As String Dim newValue As String '-- Dim path As DirectoryEntry Dim propValues As PropertyValueCollection '--

'set the IIS path
metabasePath = "IIS://Localhost/W3SVC/1/ROOT/image"

'
propertyName    = "Path"
newValue        = "d:\royshoa"

path = New DirectoryEntry(metabasePath)
propValues = path.Properties(propertyName)

propValues.Clear()
propValues.Add(newValue)
path.CommitChanges()

Response.Write(propValues.Value)

End Function

Thanks, Roy Shoa.