我想寫一個應用程序,將加密和解密已被選中的web.config。編寫一個應用程序加密/解密各種web.config(vb.net)
我已經找到了一些代碼,像這樣的應用程序中做到這一點...
進口系統 進口System.Configuration 進口System.Web.Configuration
保護小組的Page_Load(BYVAL發件人爲對象,BYVALË作爲System.EventArgs)把手Me.Load
'encrypt/decrypt identity
Dim config As Configuration
Dim configSection As ConfigurationSection
'encrypt identity
config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath)
If Not (config Is Nothing) Then
configSection = config.GetSection("system.web/identity")
If Not (configSection Is Nothing) Then
If Not (configSection.SectionInformation.IsLocked) Then
configSection.SectionInformation.ProtectSection("DataProtectionConfigurationProvider")
config.Save()
End If
End If
End If
'decrypt identity
config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath)
configSection = config.GetSection("system.web/identity")
If Not (configSection Is Nothing) Then
If Not (configSection.SectionInformation.IsLocked) Then
configSection.SectionInformation.UnprotectSection()
config.Save()
End If
End If
什麼我想要做的是把這個勝利窗體應用程序有幾個按鈕(btnEncrypt和btndecrypt的)和瀏覽控制(瀏覽到各種web.configs)。
應用程序可以被我們的OPS人使用,使他們能夠加密或解密在我們所有的Web應用程序的所有web.configs,而無需重新發布等...
任何幫助將不勝感激。
謝謝
或者使用這一切都已爲您完成:http://somewebguy.wordpress.com/2009/07/16/encrypt-your-web-config-please/ – PhilPursglove 2011-02-25 11:55:16
謝謝我會看看在那家 - 即時在工作中被阻止從該網站! – Anna 2011-02-25 12:14:48