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
How to integrate angular 8 with asp.net mvc 5? : Asp.Net MVC
i have 3+ exp in .net? i am going interview now but they asked me do you know any TOOL? which tool will i study please refer me?
What are the events in a page life cycle?
What is asp.net globalization?
What is http only cookie?
Explain about asp.net caching?
Are xaml file compiled or built on runtime?
while developing webservices if i want some users to use my webservice only how can i give security to my webservice?
What are the different types of events are occured when a client requests an ASP.NET page from IIS server?
Define common type system?
How do you change the session time-out value?
What is role-based security in asp.net?
What is bound controls
What is microsoft windows sharepoint services?
If you have an application with multiple security levels though secure login and my ASP.NET web appplication is spanned across three web-servers by using round-robbin load balancing. Explain which is the best approach to maintain login-in state for the users?