0
如何在.NET 3.5中調用需要來自WCF的Windows身份授權的asmx服務?我們僅限於.NET 3.5框架。我有憑據,但不知道如何在C#代碼中實現此功能。如何在.NET 3.5中調用需要WCF授權的asmx服務
如何在.NET 3.5中調用需要來自WCF的Windows身份授權的asmx服務?我們僅限於.NET 3.5框架。我有憑據,但不知道如何在C#代碼中實現此功能。如何在.NET 3.5中調用需要WCF授權的asmx服務
有一個在http://msdn.microsoft.com/en-us/library/ff406125認證的示例在該URL這是爲完成如下:
public decimal ReportSales()
{
var currentUser = new WindowsPrincipal((WindowsIdentity)
System.Threading.Thread.CurrentPrincipal.Identity);
if (currentUser.IsInRole(WindowsBuiltInRole.BackupOperator))
{
return 10000M;
}
else
{
return -1M;
}
}
也有在http://haacked.com/archive/2011/10/19/implementing-an-authorization-attribute-for-wcf-web-api.aspx
描述更高版本.NET WIF與編譯屬性的替代方法將是要走的路。
我希望這可以幫助...
你是什麼意思的「認證」?您的意思是隻能使用SSL訪問服務,或者需要Windows身份驗證才能訪問? – nateirvin
可能是重複關閉http://stackoverflow.com/questions/7860966/consume-asmx-service-with-wcf-client –
@nateirvin它需要Windows身份驗證,我有。但不知道如何打電話使用WCF – John