I need to add a new user account, set the user's group, and delete
the user account from within a VB.Net web application. All the examples
I've tried so far have not worked. I am using code like this to try to
add a user:
Dim objDomain as Object
objDomain = GetObject("WinNT://" & _strDomainName)
objUser = objDomain.Create("user", _strUsername)
objUser.SetPassword(_strPassword)
objUser.FullName = _strLastName & ", " & _strFirstName
objUser.Description = _strDescription
objUser.SetInfo()
the SetInfo() generates an exception like this:
at Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object
o, Type objType, String name, Object[] args, String[] paramnames,
Boolean[] CopyBack, Boolean IgnoreReturn) at
Microsoft.VisualBasic.CompilerServices.LateBinding.LateCall(Object o,
Type objType, String name, Object[] args, String[] paramnames,
Boolean[] CopyBack) at AddUser(String _strUsername, String
_strPassword, String _strLastName, String _strFirstName, String
_strListitGroup)
Note that the code *does* work for a Windows app, but I need it to
work for a web app. It could simply be a permissions issue.
The correct answer to this question will have all of the following:
1. Be written in VB.Net
2. Require no changes to the web.config file
3. Include the simplest working examples for adding a user, setting a
user's group, and deleting a user.
4. It must work for me. |