0
我有一個簡單的Web服務,通過基於表單的身份驗證處理安全性。基於WCF表單的身份驗證通過Web應用程序 - 傳遞證書
WCFTestService.ServiceClient myService = new
WCFTestService.ServiceClient();
myService.ClientCredentials.UserName.UserName = "user";
myService.ClientCredentials.UserName.Password = "secret";
lblResult.Text = myService.GetData(1231);
myService.Close();
我正在通過網絡應用程序訪問它。所以我想要做一次以上的事情,但是爲了安全/性能,不必再做一次。我想是這樣的下面,但因爲我使用FormsAuthentication這不會工作...
//Obtain the authenticated user's Identity and impersonate the original caller
using (((WindowsIdentity)HttpContext.Current.User.Identity).Impersonate())
{
WCFTestService.ServiceClient myService2 = new WCFTestService.ServiceClient();
lblResult.Text = "From Logged On Credentials"+myService2.GetData(1231);
myService2.Close();
}