G
Guest
I have configuration data for a web application stored in a file
galleryserverpro.config located in a config folder off the root application.
Web.config references this file like this:
<galleryServerPro configSource="config\galleryserverpro.config"/>
I built a custom configuration settings class (inherited from
ConfigurationSection) to access this data and it works great in Full Trust.
However, in Medium Trust I get a SecurityException on the following line:
System.Configuration.Configuration config =
System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/config/galleryserverpro.config");
It is failing because OpenWebConfiguration is trying to access
machine.config, which is not accessible under Medium Trust.
This is a web application meant for wide deployment and I have no control
over the hosting providers, so it must work in Medium Trust without any
policy alterations.
What are my options? The only idea I found was to abandon using the
configuration classes of .NET 2.0 and instead use XML classes and treat it as
an XML file. I don't want to do this because I will lose all the wonderful
features - like data type checking - of the .NET 2.0 configuration model!
I don't want to update machine.config - I only want to update this
particular file. I have 100+ configuration settings in it and I am faced with
many hours of work to port this to an XML read/write model. Hopefully I am
missing something simple.
Regards,
Roger Martin
Gallery Server Pro / www.galleryserverpro.com
galleryserverpro.config located in a config folder off the root application.
Web.config references this file like this:
<galleryServerPro configSource="config\galleryserverpro.config"/>
I built a custom configuration settings class (inherited from
ConfigurationSection) to access this data and it works great in Full Trust.
However, in Medium Trust I get a SecurityException on the following line:
System.Configuration.Configuration config =
System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/config/galleryserverpro.config");
It is failing because OpenWebConfiguration is trying to access
machine.config, which is not accessible under Medium Trust.
This is a web application meant for wide deployment and I have no control
over the hosting providers, so it must work in Medium Trust without any
policy alterations.
What are my options? The only idea I found was to abandon using the
configuration classes of .NET 2.0 and instead use XML classes and treat it as
an XML file. I don't want to do this because I will lose all the wonderful
features - like data type checking - of the .NET 2.0 configuration model!
I don't want to update machine.config - I only want to update this
particular file. I have 100+ configuration settings in it and I am faced with
many hours of work to port this to an XML read/write model. Hopefully I am
missing something simple.
Regards,
Roger Martin
Gallery Server Pro / www.galleryserverpro.com