which method marks a config file section for encryption?
Answer / 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 |
how to handle sql exceptions?
What is web api vs wcf?
what exception is thrown when you do a response.redirect
How do you pass session values from one page to another ?
What namespaces are imported by default in ASMX files?
What are the different types of Session state management options available with ASP.NET?
Which library is used by the testers and developers to develop automated tests and create testing tools?
Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines?
Asp pages that worked pefectly on windows 2000 server and iis 5.0 do not work on windows 2003 server with iis 6.0. Asp.net pages work fine. Why?
What is application variable in asp.net?
Where is the session stored?
What is CLR ? Differentiate between CLR & CTS.