which method marks a config file section for encryption?



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

Post New Answer

More ASP.NET Interview Questions

In a Code-Behind class generally which type of code is found ?

3 Answers   Siebel,


What are cookies in asp.net?

0 Answers  


What are the modes of updation in an updatepanel?

0 Answers  


What is the usie of activex control in .net?

0 Answers  


6. Tell us about a time when you failed to meet a deadline. What were the repercussions?

0 Answers   AlKhaleej, Swatz Oils,


What are the types of session in asp.net?

0 Answers  


What are the different ways you would consider sending data across pages in ASP (i.e between 1.asp to 2.asp)?

1 Answers   Net Solution,


What is http post and http get?

0 Answers  


What is a SESSION and APPLICATION object?

0 Answers  


What is asp.net globalization?

0 Answers  


I create small website, i want accept all the browser this website? what will do?

1 Answers  


Disable Session State at the Application Level

2 Answers  


Categories