Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

help with MVC active directory account unlock

$
0
0

I'm attempting to build a solution that allows a user name to be passed in and unlocks the user account.  

It appears to work properly, however the account never unlocks.  If I could specify a domain controller to unlock to, that would also be nice.

Format for URL: http://website/activedirectory/index/<username>

namespace MvcAD.Controllers
{
    public class ActiveDirectoryController : Controller
    {
        //
        // GET: /ActiveDirectory/

        public ActionResult Index(string userDn)
        {
            try
            {
                DirectoryEntry uEntry = new DirectoryEntry(userDn);
                uEntry.Properties["LockOutTime"].Value = 0; 
                uEntry.Close();
            }
            catch (System.DirectoryServices.DirectoryServicesCOMException E)
            {
            }

            return View();
        }

    }
}




Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>