Re: Impersonation a user for the duration of a method.



Hello,

and which version of the Framework are you using? Which Windows version?

Greetings,
Henning Krause

"Narendra" <Narendra@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:79D40D7D-CDB1-48B2-A516-1F368260E7E5@xxxxxxxxxxxxxxxx
> 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.
>
> "Rainier [MCT]" wrote:
>
>> 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,
>> --
>> Rainier van Slingerlandt
>> (Freelance trainer/consultant/developer)
>> www.slingerlandt.com


.



Relevant Pages

  • Re: NTLM 24-byte response generated by giving windows APIs a challeng
    ... Now I've got this odd issue:) ... use that new users cached credentials as it once did my own... ... But if Impersonate then no go..its empty. ... The user I'm logging in as is a local user on the system. ...
    (microsoft.public.platformsdk.security)
  • LogonUser issues
    ... of the local machine, it tries to impersonate me, not the credentials I gave ... public static extern int LogonUser(string lpszUsername, string lpszDomain, ... string lpszPassword, int dwLogonType, int dwLogonProvider, out IntPtr ... IntPtr admin_token; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: LogonUser issues
    ... > of the local machine, it tries to impersonate me, not the credentials I ... > string lpszPassword, int dwLogonType, int dwLogonProvider, out IntPtr ... The clone will be used to access local resources while the secondary token ... LOGON32_PROVIDER_WINNT50 a logon provider to make sure negotiate is used ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: LogonUser issues
    ... >> of the local machine, it tries to impersonate me, not the credentials I ... >> string lpszPassword, int dwLogonType, int dwLogonProvider, out IntPtr ... > The clone will be used to access local resources while the secondary token ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Use impersonation in ASPNET page to copy files
    ... If you impersonate with a non local user ...then you may need to grant ... (winnt could be windows of course, and match up your asp.net version number) ... impersonate my own network account. ...
    (microsoft.public.dotnet.framework.aspnet)