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 the latest version of asp.net?
Can anyone please tell me that the question posted on this website are Sufficient for the interview with 2+ year experience in .net
What is the difference between localization and globalization?
What is inheritance and an how it be used, example with an example?
Is it possible to migrate visual interdev design-time controls to asp.net?
while developing webservices if i want some users to use my webservice only how can i give security to my webservice?
What is windows active directory authentication?
Can a .net web application consume java web service?
Define static member?
Define msil.
What is the difference between asp.net and mvc?
What is cookies in asp net?
Is asp.net mvc still used? : Asp.Net MVC
What is difference between view state and session state?
How does u get record no from 5 to 15 from a dataset of 100 records?