Switch to full style
You can find discussions, solutions and codes related to ASP.NET
Post a reply

Encrypt connection string

Wed Nov 05, 2008 6:10 pm

Hi,

Can anyone help to , I use ASP .Net in my project , I try to encrypt my
connection string in Web.config through OOP, I use this codes to encrypt the
"ConnectionStrings", but when I run the application , it does't work.

In
Class:ImportsMicrosoft.VisualBasicImportsSystem.ConfigurationImportsSystem.Web.C\
onfigurationImports
System.SecurityPublic
ClassEncConStrClassPublicSubEncryptConnStr(ByValprotectionProvider
AsString)''---open the web.config fileDimconfig AsConfiguration =
WebConfigurationManager.OpenWebConfiguration("")''---indicate the section to
protectDimsection AsConfigurationSection =
config.Sections("connectionStrings")''---specify the protection
providersection.SectionInformation.ProtectSection(protectionProvider)'---Apple
the protection and
updateconfig.Save()EndSubsection.SectionInformation.UnProtectSection()
config.Save()
End

In Form "Behind Code":ProtectedSubPage_Load(ByValsender AsObject, ByVale
AsSystem.EventArgs) HandlesMe.LoadDimX
AsNewEncConStrClass''X.EncryptConnStr("DataProtectionConfigurationProvider")X.En\
cryptConnStr(

N.B:
When I test this codes in form directly , it works & encrypted the
connectionstring
plz help me soon,"RSAProtectedConfigurationProvider")End
SubPublicSubDecryptConnStr()Dimconfig AsConfiguration =
WebConfigurationManager.OpenWebConfiguration("")Dimsection
AsConfigurationSection = config.Sections("connectionStrings")EndSubClass



Re: Encrypt connection string

Mon May 25, 2009 11:26 pm

AskBot wrote:Hi,

Can anyone help to , I use ASP .Net in my project , I try to encrypt my
connection string in Web.config through OOP, I use this codes to encrypt the
"ConnectionStrings", but when I run the application , it does't work.

In
Class:ImportsMicrosoft.VisualBasicImportsSystem.ConfigurationImportsSystem.Web.C\
onfigurationImports
System.SecurityPublic
ClassEncConStrClassPublicSubEncryptConnStr(ByValprotectionProvider
AsString)''---open the web.config fileDimconfig AsConfiguration =
WebConfigurationManager.OpenWebConfiguration("")''---indicate the section to
protectDimsection AsConfigurationSection =
config.Sections("connectionStrings")''---specify the protection
providersection.SectionInformation.ProtectSection(protectionProvider)'---Apple
the protection and
updateconfig.Save()EndSubsection.SectionInformation.UnProtectSection()
config.Save()
End

In Form "Behind Code":ProtectedSubPage_Load(ByValsender AsObject, ByVale
AsSystem.EventArgs) HandlesMe.LoadDimX
AsNewEncConStrClass''X.EncryptConnStr("DataProtectionConfigurationProvider")X.En\
cryptConnStr(

N.B:
When I test this codes in form directly , it works & encrypted the
connectionstring
plz help me soon,"RSAProtectedConfigurationProvider")End
SubPublicSubDecryptConnStr()Dimconfig AsConfiguration =
WebConfigurationManager.OpenWebConfiguration("")Dimsection
AsConfigurationSection = config.Sections("connectionStrings")EndSubClass


Post a reply
  Related Posts  to : Encrypt connection string
 how to encrypt password in jsp     -  
 Splitting a String Based on a Found String     -  
 check if string ends with specific sub-string in php     -  
 check if string start with a specific sub-string in PHP     -  
 recursive string reversal- reverse string     -  
 Encrypt/Decrypt a file from source file to target file.     -  
 String token for string split     -  
 database connection     -  
 Connection object in jsp     -  
 Closing connection in jsp     -