jeffreyjseaman
asked on
Encryption / Decrypting Web.Config
Hello,
I have a script below that will encrypt and decrypt my web.config file.
My question is if I have the web.config encrypted, how to I access the database name, username and password when I need to access the database?
Do I need to run the decrypt code everytime when I open up a database source?
code:
Public Sub Encrypt()
Dim confg As Configuration = WebConfigurationManager.Op enWebConfi guration(R equest.App licationPa th)
Dim confgSect As ConfigurationSection = confg.GetSection(section)
If confgSect IsNot Nothing Then
confgSect.SectionInformati on.Protect Section(pr ovider)
confg.Save()
End If
End Sub
Public Sub Decrypt()
Dim config As Configuration = WebConfigurationManager.Op enWebConfi guration(R equest.App licationPa th)
Dim confgSect As ConfigurationSection = config.GetSection(section)
If confgSect.SectionInformati on.IsProte cted Then
confgSect.SectionInformati on.Unprote ctSection( )
config.Save()
End If
End Sub
Thanks
I have a script below that will encrypt and decrypt my web.config file.
My question is if I have the web.config encrypted, how to I access the database name, username and password when I need to access the database?
Do I need to run the decrypt code everytime when I open up a database source?
code:
Public Sub Encrypt()
Dim confg As Configuration = WebConfigurationManager.Op
Dim confgSect As ConfigurationSection = confg.GetSection(section)
If confgSect IsNot Nothing Then
confgSect.SectionInformati
confg.Save()
End If
End Sub
Public Sub Decrypt()
Dim config As Configuration = WebConfigurationManager.Op
Dim confgSect As ConfigurationSection = config.GetSection(section)
If confgSect.SectionInformati
confgSect.SectionInformati
config.Save()
End If
End Sub
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.