Hi,
impersonation effectively means that you setting your current thread in the security context of your client.
When you invoke a web service asynchronously, .net grabs a thread from the thread pool and executes the request. you have to rely on the framework that your impersonated account gets copied to the new thread. this behaviour is kind of "inconsistent" within .net 1.1
e.g. BeginInvoke on delegates and Thread.Start copy Thread.CurrentPrincipal to the worker thread. ThreadPool.QueueUserWorkerItem and Timer.Start don't.
Check what's in Thread.CurrentPrincipal (e.g. with debug.writeline) in your callback method. maybe you have to programmatically impersonate with,
WindowsIdentity id = (WindowsIdentity)Thread.CurrentPrincipal.User;
WindowsImpersonationContext context = id.Impersonate();
...
context.Undo();
---
Dominick Baier - DevelopMentor
http://www.leastprivilege.com
nntp://news.microsoft.com/microsoft.public.dotnet.framework.webservices/<5D**********************************@microsoft.co m>
Hi,
I have a couple of web services on two servers. I want to call one method on
one server, and based upon its result, call another method on another server.
Currently I am doing all these calls asynchronously and I call the
beginmethod call for the second call in the callback of the first. I am using
the default credentials for both web service proxy objects (which have been
set up earlier), but the second web method (which happens to be on the local
machine) is being run not as the user, but as NT AUTHORITY\SYSTEM. I have
impersonation set to true in my web.config.
Can anyone shed any light on why I get this problem? Is it bad to do this
within a callback? Any advice would be very welcome!
Thanks in advance
John Roper
iOra
[microsoft.public.dotnet.framework.webservices]