Re: Web service Impersonatation?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Frank Wisniewski (fpw23_at_hotmail.com)
Date: 12/07/04


Date: Tue, 7 Dec 2004 09:56:20 -0600

Thanks Nicholas,

But how do you know which Principal is being used by your code. Lets say I
have a routine that writes a file to the local directory, how do I ensure
that code is using my impersonated users rights?

-- 
Frank Wisniewski MCSE 4.0, MCP+I, A+
f p w 2 3 @ h o t m a i l . c o m
"Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard.caspershouse.com> wrote in
message news:%23GhWBSH3EHA.2676@TK2MSFTNGP12.phx.gbl...
> Frank,
>
>     No, they should not.  When you impersonate through the WindowsIdentity
> object, it does not change the current principal on the thread.  The
reason
> for this is that you can have different implementations of IPrincipal
which
> don't necessarily map to windows users and groups.  To that end, having
> WindowsIdentity change the current thread's principal would be wrong.
>
>     Hope this helps.
>
>
> -- 
>                - Nicholas Paldino [.NET/C# MVP]
>                - mvp@spam.guard.caspershouse.com
>
> "Frank Wisniewski" <fpw23@hotmail.com> wrote in message
> news:41b5cf8c$1_2@Usenet.com...
> > When I set up impersonation in the web.config file and specify a user
and
> > password I get strange results.  This line of code will get me the user
> > account I set to impersonate:
> > System.Security.Principal.WindowsIdentity.GetCurrent().Name
> >
> > This line of code will get me my user account ever time:
> >
> > System.Threading.Thread.CurrentPrincipal.Identity.Name
> >
> > What's the difference? shouldn't they both be the user I am trying to
> > impersonate?
> >
> > Thanks
> >
> >
> > Frank Wisniewski MCSE 4.0, MCP+I, A+
> > f p w 2 3 @ h o t m a i l . c o m
> >
> >
>
>


Relevant Pages

  • RE: COM dll thread security issue while accessing from ASP.NET
    ... I save a reference to the current WindowsIdentity ... IIS authenticated user account. ... impersonate the identity of the WindowsIdentity object saved above. ... the 'Impersonator' event handler is running inside the COM dll thread, ...
    (microsoft.public.dotnet.security)
  • Re: Web service Impersonatation?
    ... Frank Wisniewski MCSE 4.0, MCP+I, A+ ... When you impersonate through the WindowsIdentity ... >> This line of code will get me my user account ever time: ...
    (microsoft.public.dotnet.framework)
  • Re: Web service Impersonatation?
    ... Frank Wisniewski MCSE 4.0, MCP+I, A+ ... When you impersonate through the WindowsIdentity ... >> This line of code will get me my user account ever time: ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Web service Impersonatation?
    ... Frank Wisniewski MCSE 4.0, MCP+I, A+ ... When you impersonate through the WindowsIdentity ... >> This line of code will get me my user account ever time: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Web service Impersonatation?
    ... Frank Wisniewski MCSE 4.0, MCP+I, A+ ... >> account I set to impersonate: ... >> This line of code will get me my user account ever time: ... >> Frank Wisniewski MCSE 4.0, MCP+I, A+ ...
    (microsoft.public.dotnet.languages.csharp)