Hi,
I'm running a ASP.NET application using the anonimous user. (ASPNET)
I don't want the user to log in and I don't want to give any more rights to
the ASPNET user either. So I thought of impersonating a local user just for
the duration of a single method.
That user will access the local SAM and retrieve some info.
I've found code on the internet which shows me how to login using COM calls
releasing the handles and dublicating tokens. Yuck.
[DllImport("advapi32.dll", SetLastError=true)]
public static extern bool LogonUser(string pszUsername, string pszDomain,
string pszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken);
Isn't there some other dot.net like way to do this ?
Something like an attribute with a username and a password I can set above
my method?
Hope someone can release me of this COM code quick.
Kind Regards,

Signature
Rainier van Slingerlandt
(Freelance trainer/consultant/developer)
www.slingerlandt.com
Dominick Baier [DevelopMentor] - 30 Jan 2006 14:13 GMT
Hi,
look at the <identity impersonate="true" username="xx" password="xx" />
setting in web.config.
---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com
> Hi,
> I'm running a ASP.NET application using the anonimous user. (ASPNET)
[quoted text clipped - 20 lines]
>
> Kind Regards,
Narendra - 30 Jan 2006 14:50 GMT
Hi!
I think more clarity is required from your side. Why do you want to do
impersonation for only one method? If I am not wrong, you want to
impersonate. But which user you want to impersonate?
regards,
narendra.
> Hi,
> I'm running a ASP.NET application using the anonimous user. (ASPNET)
[quoted text clipped - 17 lines]
>
> Kind Regards,
Henning Krause [MVP] - 30 Jan 2006 19:12 GMT
Hello,
and which version of the Framework are you using? Which Windows version?
Greetings,
Henning Krause
> Hi!
> I think more clarity is required from your side. Why do you want to do
[quoted text clipped - 30 lines]
>>
>> Kind Regards,