2011-02-22 44 views
4

我有一個命令行使用以下類型的代碼ASPNET_REGIIS運行的C#代碼的負載:編寫C#代碼使用ASPNET_REGIIS功能進行了加密

 ProcessStartInfo procStartInfo = new ProcessStartInfo(aspRegPath, arguments); 
     procStartInfo.CreateNoWindow = true; 
     Process proc = new Process(); 
     proc.StartInfo = procStartInfo; 
     proc.Start(); 
     .... 

然後,我想看看我是否能做到使用常規的.NET類相同的功能。我可以使用.NET類使用類似的加密和解密的東西ASPNET_REGIIS在做:

 ConfigurationSection section = configuration.GetSection("connectionStrings"); 
     section.SectionInformation.ProtectSection("RSAKey"); 
     configuration.Save(); 

但我無法找到.NET類做其他的功能即

 //Delete container 
     aspnet_regiis -pz RSAKey 

     //Create the container 
     aspnet_regiis -pc RSAKey-exp 

     //Install the key into a machine-level RSA key provider called DealAxisRSAKey 
     aspnet_regiis -pi RSAKey pathToKeyFile 

     //Grant access to the contrainer 
     aspnet_regiis -pa RSAKey "NT Authority\Network service" 

任何人都知道這是可能的嗎?或者我必須使用aspnet_regiis?

+0

你想要一個具有aspnet_iisreg功能的.net類,所以你不必打電話給外部命令?或者你是否想要加密的東西用於你的調用aspnet_iisreg?你的問題不是很清楚。 – 2011-02-22 16:37:08

回答

0

對不起,但沒有這樣的課......至少不是在.net開箱。你可以建立一個或者也許別人已經建立了一個。

相關問題