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 are the ihttphandler and ihttphandlerfactory interfaces ?
What are the major built-in objects in ASP.NET?
What is difference between datalist and gridview?
How can I open ashx file in mobile?
Contrast OOP and SOA. What are tenets of each ?
Explain the reason why the javascript validation not run on the asp.net button but run successfully on the html button?
What is a session http?
Why is string called immutable data type?
How do you implement sql caching in asp.net?
What is active web page?
What is difference between mvc and asp.net? : Asp.Net MVC
What is a web api?
How to fetch a data from one table to another table in asp.net ?
i want to implement grid view value in paypal site. so how to create this code in asp.net with C#
Will session work if cookies is disabled?