【发布时间】:2009-10-19 09:43:36
【问题描述】:
我正在使用 Silverlight 应用程序进行 FormsAuthentivcation。当 SL 应用程序调用 WCF 服务时,我试图从我的 WCF 服务中获取经过身份验证的用户名,如下所示:
ServiceSecurityContext.Current.PrimaryIdentity.Name;
或this(不确定使用哪个,问题是两者都是空的)
ServiceSecurityContext.Anonymous.PrimaryIdentity.Name;
我使用这样的绑定配置了 wcf 服务:
<basicHttpBinding>
<binding name="myBinding">
<security mode="None">
<message clientCredentialType="UserName"/>
</security>
</binding>
问题是我无法获得身份。我没有在客户端中手动设置凭据。 proxy.ClientCredentials.UserName.UserName="slkfslkdf"; (我必须这样做吗?)
感谢您的帮助!
【问题讨论】:
标签: wcf silverlight authentication