Wed Nov 05, 2008 6:10 pm
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
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.