我正在从 ASP.NET 应用程序调用 WCF 服务。由此,我使用 WSHTTPBinding 访问 WCF 服务。我可以从 HttpContext.Current.User.Identity.Name 获取当前用户。我希望能够将其传递给 WCF(不使用自定义标头 - 肯定有适当的方法可以做到这一点。)它必须是 HttpContext.Current.User 中的标识。 Identity.Name 而不是 WindowsIdentity.GetCurrent().Name
,因为此服务可能由使用表单或 Windows 身份验证的 ASP.nET 应用程序使用。据我了解,它应该出现在 ServiceSecurityContext.Current.PrimaryIdentity.Name
中。我已经寻找了很长时间试图找到这个问题的答案,但还没有找到。
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.
发布评论
评论(1)
看看用户名验证:)
http://codebetter.com/petervanooijen/2010/03/22/a-simple-wcf-service-with-username-password-authentication-the-things-they-don-t-tell-你/
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/