which method marks a config file section for encryption?
Answer Posted / guest
protected void Page_Load(object sender, EventArgs e) {
Configuration config;
ConfigurationSection configSection;
config = WebConfigurationManager.OpenWebConfiguration
(Request.ApplicationPath);
configSection = config.GetSection("connectionStrings");
if (configSection != null) {
if (!(configSection.SectionInformation.IsLocked)) {
configSection.SectionInformation.ProtectSection("
DataProtectionConfigurationProvider");
config.Save();
} } }
To unprotect :
Public Sub Page_Load()
Dim config As Configuration
Dim configSection As ConfigurationSection
config = WebConfigurationManager.OpenWebConfiguration
(Request.ApplicationPath)
configSection = config.GetSection("connectionStrings")
If Not (configSection Is Nothing) Then
If Not (configSection.SectionInformation.IsLocked) Then
configSection.SectionInformation.UnprotectSection()
config.Save()
End If
End If
End Sub
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
what is command line compiler.what are the steps and how it is related to debugging.
What is datagrid asp.net?
What is application and session in asp.net?
What is the file extension of web service?
To wrap up a call to a Web service the standard used is..?
What is a postback ispostback and autopostback in asp net?
Explain the difference between AutoPostBack and IspostBack in ASP.NET?
Which is better viewstate or session?
Explain how asp.net different from asp?
How does session work in asp net?
Define web.config in .net?
What are the authentication types in asp.net?
What is the difference between executescalar and executenonquery?
What is asp.net and its advantages?
what are the ihttphandler and ihttphandlerfactory interfaces ?