How do you change the trust level for an APS.NET application?

  • Thread starter Thread starter g3000
  • Start date Start date
G

g3000

I used VS .Net 2003 to run a c# web app.

but when I run it I get the 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:
System.Security.Permissions.SecurityPermission

Source Error:


[No relevant source lines]


Source File: default.aspx.cs Line: 136

Stack Trace:


[SecurityException: System.Security.Permissions.SecurityPermission]
AspNetResources.Owc._default.BuildCharts() in default.aspx.cs:136
AspNetResources.Owc._default.Page_Load(Object sender, EventArgs e)
in default.aspx.cs:26
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+6953
System.Web.UI.Page.ProcessRequest(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+154
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
+18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.default_aspx.ProcessRequest(HttpContext context) +4

System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+154
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously) +64


any ideas of how to change the trust level?
 
trust levels for asp.net is set in the machine.config under <securityPolicy>

-- bruce (sqlwork.com)
 
well this is what I have in machine.config

<location allowOverride="true">
<system.web>
<securityPolicy>
<trustLevel name="Full" policyFile="internal"/>
<trustLevel name="High" policyFile="web_hightrust.config"/>
<trustLevel name="Medium" policyFile="web_mediumtrust.config"/>
<trustLevel name="Low" policyFile="web_lowtrust.config"/>
<trustLevel name="Minimal" policyFile="web_minimaltrust.config"/>
</securityPolicy>
<!-- level="[Full|High|Medium|Low|Minimal]" -->
<trust level="Full" originUrl=""/>
</system.web>
</location>
 
Back
Top