views:

38

answers:

1

Hi everybody.

Is there any 'nice' way to read configuration section group of IIS7 by using WebConfigurationManager o anything? I tried to read the authorization section but WebConfigurationManager.GetSection() returns an 'IgnoredSection' instance. This is what my code looks like...

authSection = WebConfigurationManager.GetSection("system.webServer/security/authorization", HttpContext.Current.Request.Path)

Thanks!

A: 

Hi take a look at this post:

http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/31827ac7-8ab0-4eba-a37a-33ad19942e62

MUG4N
I did, thanks. I tried to use Microsoft.Web.Administration.WebConfigurationManager, but I couldn't get the ChildElements of system.webServer/security/authorization.
Maxolidean
It returns zero elements. I'm sure it has elements since i got open the section using System.Web.WebConfigutaionManager with the debugger and could see inside the private properties the raw XML/
Maxolidean
I would probably recommend to move your section away from system.webServer and write your own section handler that using System.Configuration derived classes gives you the parsed version instead of just the XML. Basically the idea is that you would register in your web.config or in machine.config your section handler something like: <section name="system.webServer/yourCustomSection" type="YourOwnAssembly.YourNamespace.YourConfigurationSectionDerivedClass, YourOwnAssembly, Version=.."/>
MUG4N