﻿<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://developers.de/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Impersonating by username and password</title><link />http://developers.de/blogs/damir_dobric/archive/2007/10/19/impersonating-by-username-and-password.aspx<description>Sometimes it is required to authenticate the user when username and password are known. For this the windows API LogonUser function is used. This function, with little bit .NET code, can be used to fully authenticate the thread in .NET as it would be</description><dc:language>en</dc:language><generator>CommunityServer 2008 SP1 (Build: 30619.63)</generator><item><title>User Impersonation in WindowsForms and WPF</title><link />http://developers.de/blogs/damir_dobric/archive/2007/10/19/impersonating-by-username-and-password.aspx#10807<pubdate>Fri, 19 Mar 2010 10:05:06 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:10807</guid><dc:creator>DamirDobric</dc:creator><description>&lt;p&gt;Following example shows how to enforce interactive user in Windows Forms or WPF applications to become&lt;/p&gt;
&lt;img src="http://developers.de/aggbug.aspx?PostID=10807" width="1" height="1"&gt;</description></item><item><title>UserImpersonation in WindowsForms and WPF</title><link />http://developers.de/blogs/damir_dobric/archive/2007/10/19/impersonating-by-username-and-password.aspx#10806<pubdate>Fri, 19 Mar 2010 09:48:57 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:10806</guid><dc:creator>Damir Dobric Posts</dc:creator><description>&lt;p&gt;Following example shows how to enforce interactive user in Windows Forms or WPF applications to become&lt;/p&gt;
&lt;img src="http://developers.de/aggbug.aspx?PostID=10806" width="1" height="1"&gt;</description></item><item><title>re: Impersonating by username and password</title><link />http://developers.de/blogs/damir_dobric/archive/2007/10/19/impersonating-by-username-and-password.aspx#1616<pubdate>Mon, 22 Oct 2007 14:09:02 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:1616</guid><dc:creator>dominick</dc:creator><description>&lt;p&gt;You are missing crucial cleanup code&lt;/p&gt;
&lt;p&gt;a) you have to call Win32 CloseHandle on the handle returned by LogonUser&lt;/p&gt;
&lt;p&gt;b) you don't have to duplicate the token - this is done by the WindowsIdentity ctor&lt;/p&gt;
&lt;p&gt;c) put the WindowsIdentity in a using statement to enforce prompt handle cleanup&lt;/p&gt;
&lt;p&gt;d) put the WindowsImpersonationContext into a using statement to ensure that impersonation gets undone.&lt;/p&gt;
&lt;p&gt;dominick&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=1616" width="1" height="1"&gt;</description></item></channel></rss>