tags:

views:

16

answers:

0

I'm working on a web page to add/remove IP Addresses to the IIS IPGranted List for a website.

I'm finding I can connect and accurately return a list of all of the Allowed IP Addresses from IIS.

However, if I try to edit it, on CommitChanges() I'm finding that the com object is returning a HRESULT:0x800700B7 (Meaning it can't create a file when that file already exists).

Sometimes however, it does update. I can add to the list, but only if I add only that new addition to the list, and not the entire list of allowed entries PLUS the new additions (whcih is recommended on MSDN and various other soruces).

I can confirm that GrantByDefault is set to 'false' (which it should be for the IPGrant table (true is only for accessing the IPDeny Table)).

In addition, I can confirm the correctlist of objects are passing throught the page.

I'm running this program on the ASP.NET Development server (default with VS) and my (seperate) IIS Service is stopped. (I've also tried with it started, to no avail).

Code used to edit the list:

IPSecurity.GetType().InvokeMember("IPGrant",
    BindingFlags.DeclaredOnly |
    BindingFlags.Public | BindingFlags.NonPublic |
    BindingFlags.Instance | BindingFlags.SetProperty, 
    null, IPSecurity, new object[] { ipList });

IIS.Properties["IPSecurity"].Value = IPSecurity;
IIS.CommitChanges();
IIS.RefreshCache();

Does anyone understand why this is happening, or have any of you encountered this before? Is there a fix?