views:

159

answers:

1

On the client I have setup the bus with ImpersonateSender(true)

My server is configured AsA_Server, which by default should have ImpersonateSender(true)

I'm now trying to retrieve the WindowsIdentity, from inside a Handler

var windowsIdentity = WindowsIdentity.GetCurrent(true);

But this is giving me null.

What am I doing wrong?

+1  A: 

Use System.Threading.Thread.CurrentPrincipal instead.

Also, don't set ImpersonateSender on the client - it'll send it's credentials regardless.

Udi Dahan
I looked at that, but that only gives me a GenericPrincipal. I need to get WindowsIdentity so I can get the windows token for the user.
John Simons
Tackling the problem in a different way:http://stackoverflow.com/questions/2854198/nservicebus-how-to-pass-custom-headers-in-the-message-envelop
John Simons
Inside the CurrentPrincipal is an IIdentity which can be cast to a WindowsIdentity.
Udi Dahan