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
Is web config mandatory?
How can you identify that the page is post back?
Can I stream live content/events?
What are the namespace classes used in asp.net mvc? : asp.net mvc
Give an example of what might be best suited to place in the application_start and session_start subroutines?
What is the basic purpose of the required field validator? How can you use a required field validator to check that the user changes the initial value of a text box? a listbox?
How should I destroy my objects in asp.net?
What is the significance of ASP.NET routing?
What is enableviewstate?
i want to implement grid view value in paypal site. so how to create this code in asp.net with C#
What are resource file and how do we generate resource file?
Take a Large textbox allow to type any data. Task 1:display the count of vowels in a lable on key press event of the textbox Task 2:dispaly count of dates in a lable when dates in following foramats:dd/mm/yy , mm/dd/yy , yy/mm/dd. Task3:compare 2 dates and display both are same or not which dates are in dd/mm/yy and mm/dd/yy farmats.
Explain the different types of assemblies?
What is autopostback in dropdownlist in asp net?
What is difference between viewstate and session state in javascript?