Re: System.Security.SecurityException: Security error

From: Daniel Fisher\(lennybacon\) (info_at_(removethis)lennybacon.com)
Date: 12/10/04


Date: Fri, 10 Dec 2004 17:25:40 +0100

1. Have you tried to set this?

> <configuration>
> <system.web>
> <compilation debug="true"/>
> </system.web>
> </configuration>

2. You have some code that is not allowed under the trust level

Here is an overview what you CAN DO and CAN NOT DO based on
different trust levels.
http://www.asp.net/whitepaper/aspnet_hosting_public.doc

-- 
Daniel Fisher(lennybacon)
 MCP ASP.NET C#
 Blog: http://www.lennybacon.com/
"Abish Asharaf via DotNetMonster.com" <forum@DotNetMonster.com> wrote in 
message news:697d0aae2a8044e8922b249f997bf3b0@DotNetMonster.com...
> Dear All,
>    The problem or error which I am getting while running my web 
> application is as given below:
>
>
> 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: Security error.
>
> Source Error:
>
> The source code that generated this unhandled exception can only be shown 
> when compiled in debug mode. To enable this, please follow one of the 
> below steps, then request the URL:
>
> 1. Add a "Debug=true" directive at the top of the file that generated the 
> error. Example:
>
>  <%@ Page Language="C#" Debug="true" %>
>
> or:
>
> 2) Add the following section to the configuration file of your 
> application:
>
> <configuration>
>   <system.web>
>       <compilation debug="true"/>
>   </system.web>
> </configuration>
>
> Note that this second technique will cause all files within a given 
> application to be compiled in debug mode. The first technique will cause 
> only that particular file to be compiled in debug mode.
>
> Important: Running applications in debug mode does incur a 
> memory/performance overhead. You should make sure that an application has 
> debugging disabled before deploying into production scenario.
>
> Stack Trace:
>
> [SecurityException: Security error.]
>   ASP.Default_aspx..ctor() +0
>
>
> Version Information: Microsoft .NET Framework Version:1.1.4322.2032; 
> ASP.NET Version:1.1.4322.2032
>
>                  I have tried to solve this problem by changing my .net 
> version number, by signing in the .netkey, But I could not get this 
> working. The server which I have hosted this application is not accessible 
> for me. Could anyone help me in getting this solved.
>
> It would be more appriciated for getting a solution to solve this problem.
>
> -- 
> Message posted via http://www.dotnetmonster.com 


Relevant Pages

  • Re: reading web.config section
    ... I just wanna know WHY system.web is impossible to access!!! ... you'll have to talk to your ISP about allowing you to override the trust settings. ... I can't set y application because I'm running in a hosting enviroment where the security level ... You may need to set your applications trust level accordingly: ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: How do you change the trust level for an APS.NET application?
    ... > allowed by the security policy. ... > application's trust level in the configuration file. ... > includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) ... > System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: reading web.config section
    ... they just repeat and repeat that the server has Medium Level. ... where the security level is Medium. ... and to any config files above it in the same application. ... You may need to set your applications trust level accordingly: ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: .NET 2.0 Trust issue on Hosted Server
    ... I would set the trust level to medium on my local copy too and try to debug... ... i just use what's in the config file: ... There's nothing on my pages that is a big security issue. ...
    (microsoft.public.dotnet.framework.aspnet.security)