Accessing system.web config settings in medium trust

D

daveh551

I am trying to access (read only) an element from the system.web
section of the web.config file, specifically, the machineKey section.
My application is running in a hosting environment under medium trust,
which forbids file access outside your application directory, and
thus, forbids access to the machine.config and machine-level
web.config files. I thought I could override this by placing a
machineKey section in my local (app level) web.config file, but it
still blows up with a file permission error even when I try to open
the local file (using WebConfigurationManager.OpenWebConfiguration
("<localdirectory>")). Reading the documentation, it appears that any
access to any WebConfiguration element, even if I were to use
WebConfigurationManager.OpenMappedWebConfiguration(). still requires
read access to all the config files from which settings are inherited.

I'm thinking if I have to, I can open the web.config file as an XML
Document and parse it to extract my info, but is there an easier way
to do this using the Web.Configuration methods under medium trust
without going to all that trouble?

Thanks for your assistance.
 

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,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top