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 Razor View Engine
What are the main differences between asp and asp.net?
If 200 is for all successful operation then why do we have 201 response codes?
What is preprocessor in .net?
What is the use of view state?
Explain in what order a destructors is called.
Can I stream live content/events?
How would you turn off cookies on a page of a website?
What are early binding and late binding.
Define the term Scavenging in Caching?
What does session_start () do?
What is the difference between CC and BCC?
How may clustered index we can create in table?
Fetch one page value to another page without using state-managment ?
What does asax stand for?