Re: reading web.config section
- From: "alf" <alfredo@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 1 Mar 2007 11:15:15 -0500
Well, I tryed a lot to get understan with this guys from the support staff,
but nothing, they just repeat and repeat that the server has Medium Level.
Doing some test I found that:
GetSection("appSettings"); // OK to read
GetSection("connectionString"); // OK to read
GetSection("system.web"); // Unable to read. Security Exception
I just wanna know WHY system.web is impossible to access !!!
Anyway, now I can read the entire web.config file using XmlDocument. So, my
problem is solved but I would like to investigate about it.
"John Timney (MVP)" <x_john@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:uZGdnfUbCvLZmXvYnZ2dnUVZ8tOmnZ2d@xxxxxxxxxxxxxxxxx
If your in a hosting environment, ask your hosting company to give you an
example that works with their trust level settings.
Regards
John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog
"alf" <alfredo@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:ewhk%23I1WHHA.4860@xxxxxxxxxxxxxxxxxxxxxxx
Hi Timmey,
I can't set y application because I'm running in a hosting enviroment
where the security level is Medium.
I can read the sections: "appSetting" and "connectionStrings" perfectly
but not the "system.web"... why ???
any idea ??
thanks
"John Timney (MVP)" <x_john@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:T5Kdnaa1dIBxXHnYnZ2dnUVZ8t-nnZ2d@xxxxxxxxxxxxxxxxx
Your user (the account asp.net runs under) needs to have read permission
to the file, and to any config files above it in the same application.
You may need to set your applications trust level accordingly:
http://msdn2.microsoft.com/en-us/library/tkscy493(VS.80).aspx
Regards
John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog
"alf" <alfredo@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:uzfqmsrWHHA.1208@xxxxxxxxxxxxxxxxxxxxxxx
Hi folks,
I'm trying to read a web.config section using
RoleManagerSection settings =
(RoleManagerSection)System.Configuration.ConfigurationManager.GetSection("system.web/roleManager");
and I get the following error on the page:
Security Exception
Description: The application attempted to perform an operation not
allowed by the security policy. To grant this application the required
permission please contact your system administrator or change the
application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the
permission of type 'System.Security.Permissions.FileIOPermission,
mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' failed.
There is any security restriction on the server?? there is other way to
acces config information ??
Thanks
.
- Follow-Ups:
- Re: reading web.config section
- From: Juan T. Llibre
- Re: reading web.config section
- References:
- Re: reading web.config section
- From: John Timney \(MVP\)
- Re: reading web.config section
- Prev by Date: Re: how to filter content in a nested repeater
- Next by Date: Problem with a Gridview
- Previous by thread: Re: reading web.config section
- Next by thread: Re: reading web.config section
- Index(es):
Relevant Pages
|