DirectoryEntry and msRADIUSFramedIPAddress

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Davide Rimondi
    New Member
    • Oct 2010
    • 1

    DirectoryEntry and msRADIUSFramedIPAddress

    Hello,
    I would like create a simple user and setting a static IP to him. but every time I try to set msRADIUSFramedI PAddress property i have this message of error:
    System.Runtime. InteropServices .COMException (0x8000500F): The directory property cannot be found in the cache.
    Please help me (and sorry my english).

    Code:
     public void createNewUser(String userName,String Password,String staticIp)
            {
                try
                {
                    string s_Username = userName;
                    string s_Password = Password;
                    string s_Description = "Test User Account";
    
                    DirectoryEntry AD = new DirectoryEntry("WinNT://" + Environment.MachineName + ",computer");
                    // create a new user
                    DirectoryEntry NewUser = AD.Children.Add(s_Username, "user");
                    // set the properties
                    NewUser.Invoke("SetPassword", new object[] { s_Password });
                    NewUser.Invoke("Put", new object[] { "Description", s_Description });
                     NewUser.Properties["msRADIUSFramedIPAddress"].Add(staticIp);           
    
                    // commit the changes
                    NewUser.CommitChanges();
                    txtResult.Text = "Success!!";
                }
                catch (Exception err)
                {
                    // set the error message
                    txtResult.Text = err.ToString();
                }
            }
    Davide
Working...