WebConfigurationManager.GetSection in Medium Trust

R

Roger Martin

Is it possible for a medium trust web application to read the Membership
providers? The following throws a SecurityException:

MembershipSection membershipSection =
(MembershipSection)WebConfigurationManager.GetSection("system.web/membership");

I have custom sections in my web.config where I specify
requirePermission="false", which allows them to be read in medium trust, but
it does not seem possible to do this for the membership section. When I
attempt it, like putting the following at the top of web.config...

<section name="membership" type="System.Web.Configuration.MembershipSection,
System.Web" allowDefinition="MachineToApplication" requirePermission="false"
/>

....I get the error "There is a duplicate 'system.web/membership' section
defined". I understand it may be possible to get around this by editing the
machine-level web.config so that allowOverride="true", but this is not an
option in my case, as I am developing a web application for wide
distribution, and I do not want to require my users to edit the machine-level
web.config.

Thanks,
Roger Martin
 
R

Roger Martin

Thanks for confirming that. And thanks also for the XmlReader sample code.
That is exactly what I needed, and I am back in the ballgame now.

Cheers,
Roger Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top