Reading web.configuration values in asp.net application

Posted by hima on Stack Overflow See other posts from Stack Overflow or by hima
Published on 2010-05-31T13:20:10Z Indexed on 2010/05/31 13:23 UTC
Read the original article Hit count: 188

Filed under:

In my asp.net application I want to read authorization section of web.config and modify that. For that I am using the below code but I am not getting the values. So have a look at it and let me know if there is any way to read and update authorization section values AuthorizationSection section; my section is like the following

 <authorization>
       <deny users="?"/>
 </authorization>

And this is the code:

configuration = WebConfigurationManager.OpenWebConfiguration("~");
section = (AuthorizationSection)configuration.GetSection("system.web/authorization"); 
SectionInformation sc= section.SectionInformation;

Thanks, Hima.

© Stack Overflow or respective owner

Related posts about ASP.NET