A complete Impersonation Demo in C#.NET | .NET API-Libraries-Tools | Scoop.it

Under some scenarios, we need to impersonate another Windows account and do some work under that user’s session, for example:An enterprise ASP.NET web application provides server administrators’ ability to access the server under some specific privilege set; Server admin inputs their NT account information (domain\account + password) on the page, we need to get WinNT Access Token and then impersonate this server user, so that we acquire its specific privilege and do the things ONLY THIS ACCOUNT CAN DO.We developed a Windows Service which needs internet access periodically, but a specific user sets anSock5 proxy to access internet, then your Windows Service needs to know the Socks proxy information so that it could access internet, you must impersonate this user and read the settings.