2009-10-19 110 views
0

我在Silverlight應用程序上執行FormsAuthentivcation。當SL應用程序調用WCF服務,我想這樣從我的WCF服務中獲得認證的用戶名:從Silverlight應用程序調用WCF服務時獲取身份驗證使用窗體身份驗證

ServiceSecurityContext.Current.PrimaryIdentity.Name; 

或本(不確定其使用,問題是,無論是空的)

ServiceSecurityContext.Anonymous.PrimaryIdentity.Name; 

我有這樣的綁定配置WCF服務:

<basicHttpBinding> 
    <binding name="myBinding"> 
     <security mode="None"> 
     <message clientCredentialType="UserName"/> 
     </security> 
    </binding> 

問題是,我無法獲得認同。我沒有在客戶端手動設置憑證。 proxy.ClientCredentials.UserName.UserName = 「slkfslkdf」; (我必須這樣做嗎?)

感謝您的任何幫助!

回答

0

這只是簡單地通過HttpContext.Current.User;解決方案在進行表單身份驗證時,無需進入自定義標頭或ServiceSecurityContext。

相關問題