W
Web Developer
I have an ASP.Net web application that uses Integrated Authentication. I'd
like to impersonate the person making the request at RUNTIME instead of
specifying impersonate="true" in the web.config.
Does anyone know how I can get the requesting user's userToken to pass to
the Impersonate method of the
System.Threading.Thread.CurrentPrincipal.Identity?
i.e.
'Retrieve the requesting user's security token
Dim userToken as IntPtr = /Some call here/
Dim MyImpersonationContext As
System.security.Principal.WindowsImpersonationContext
'Temporarily impersonate the requesting user
MyImpersonationContext =
CType(System.Threading.Thread.CurrentPrincipal.Identity(),
System.Security.Principal.WindowsIdentity).Impersonate(userToken)
'Call a web service with using the logged-on user's credentials
'Revert the impersonation
MyImpersonationContext.Undo()
Thanks for your help!
like to impersonate the person making the request at RUNTIME instead of
specifying impersonate="true" in the web.config.
Does anyone know how I can get the requesting user's userToken to pass to
the Impersonate method of the
System.Threading.Thread.CurrentPrincipal.Identity?
i.e.
'Retrieve the requesting user's security token
Dim userToken as IntPtr = /Some call here/
Dim MyImpersonationContext As
System.security.Principal.WindowsImpersonationContext
'Temporarily impersonate the requesting user
MyImpersonationContext =
CType(System.Threading.Thread.CurrentPrincipal.Identity(),
System.Security.Principal.WindowsIdentity).Impersonate(userToken)
'Call a web service with using the logged-on user's credentials
'Revert the impersonation
MyImpersonationContext.Undo()
Thanks for your help!