2014-07-07 24 views
-2

我必須驗證pfx文件並從網絡基本應用程序 獲得證書的詳細信息,但它沒有工作後主辦頁面IIS,它只能在單機上工作。證書(pfx文件)在代碼中工作,但無法工作後主機從ASP網絡應用程序

- 首先創建一個exe爲獲取詳細信息,但仍然它不工作,

(exe文件保存在一個表中。 響應我們想獲取在Web應用程序的響應。 這是通過代碼工作但託管之後,這是行不通的。)

我通過創建批處理文件獲取數據。

,如:

請給我如何從exe文件獲取數據到Web應用程序的任何建議或想法。 任何人都可以有想法請告訴我。

謝謝。

回答

0

.NET中加載的證書與用戶配置文件和證書存儲綁定 - 即使證書是從文件加載的。當在託管環境加載一些特殊的標誌需要添加:

// The X509KeyStorageFlags.MachineKeySet flag is required when loading a 
// certificate from file on a shared hosting solution such as Azure. 
private static readonly X509Certificate2 signingCertificate = 
    new X509Certificate2(HttpContext.Current.Server.MapPath(
    "~\\App_Data\\Kentor.AuthServices.StubIdp.pfx"), "", 
    X509KeyStorageFlags.MachineKeySet); 

Exampel從https://github.com/KentorIT/authservices/blob/master/Kentor.AuthServices.StubIdp/Models/AssertionModel.cs

相關問題