I'm calling a WCF service from an ASP.NET application. From this, I am accessing a WCF service using WSHTTPBinding. I can get the current user from HttpContext.Current.User.Identity.Name
. I want to be able to pass this to WCF (not using a custome header - surely there is a proper way to do this.) It must be the identity in HttpContext.Current.User.Identity.Name
and not WindowsIdentity.GetCurrent().Name
, as this service may be consumed from ASP.nET applications that use Forms or Windows authentication. From what I understand, it should appear in ServiceSecurityContext.Current.PrimaryIdentity.Name
. I have search for ages to try to find the answer to this but have not yet found it.
Have a look at Username Authentication :) http://codebetter.com/petervanooijen/2010/03/22/a-simple-wcf-service-with-username-password-authentication-the-things-they-don-t-tell-you/