Assembly does not allow partially trusted callers

G

g3000

I developed on a Win2K3 Server with VS 2005

Published a web app to my local drive.

Copied that folder to a Win2K3 Server. Configured a new virtual
directory
Moved the files there.
Modified the config file so debug=false

Then tried to run it. There are basically two pages in the app. The
first page works fine.
The second page did not work it gave me the below error.
The second page was supposed to show a scatter chart based on
parameters chosen on the first page. The image for the chart is usually
written to the folder of the asp app tree.

Server Error in '/ProjectReports' Application.
--------------------------------------------------------------------------------

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: That assembly
does not allow partially trusted callers.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.


Stack Trace:


[SecurityException: That assembly does not allow partially trusted
callers.]
_Default.Page_Load(Object sender, EventArgs e) +0
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object
o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object
sender, EventArgs e) +34
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
 
W

Winista

Have you set appropriate permisison on the folder where image files are
being written?
 
B

Bruce Barker

read the documentation on managed/unmanged and trusted/untrusted .net code.

basically your page is calling an untrusted code (usually unmanaged code
like a com object) and asp.net on the server is configured to not allow that
(common on a shared server).

-- bruce (sqlwork.com)



g3000 said:
I developed on a Win2K3 Server with VS 2005

Published a web app to my local drive.

Copied that folder to a Win2K3 Server. Configured a new virtual
directory
Moved the files there.
Modified the config file so debug=false

Then tried to run it. There are basically two pages in the app. The
first page works fine.
The second page did not work it gave me the below error.
The second page was supposed to show a scatter chart based on
parameters chosen on the first page. The image for the chart is usually
written to the folder of the asp app tree.

Server Error in '/ProjectReports' Application.
--------------------------------------------------------------------------------

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: That assembly
does not allow partially trusted callers.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.


Stack Trace:


[SecurityException: That assembly does not allow partially trusted
callers.]
_Default.Page_Load(Object sender, EventArgs e) +0
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object
o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object
sender, EventArgs e) +34
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
 
G

g3000

Bruce I think you are right.

I didnt have the Fwk 2.0 Configuration console on the machine to add a
dll that is used in my web app to the GAC.

So I am currently downloading the SDK for 2.0 and hopefully that has
the management console included in it.

I thought just loading the 2.0 framework should have the management
console.

thanks everyone for your response.
 
S

Scott Allen

read the documentation on managed/unmanged and trusted/untrusted .net code.

basically your page is calling an untrusted code (usually unmanaged code
like a com object) and asp.net on the server is configured to not allow that
(common on a shared server).

It's the other way around.

An assembly in the GAC is a trusted assembly - the GAC grants Full
Trust by default.

The web app must be running at partial trust, i.e. somewhere in a
configuration file at the web site or machine level there is a <trust
level="Medium"/> element, or another level, but not FullTrust.

..NET will not let your partially trusted code call into the GAC'ed
assembly unless the assembly specifically instructs the runtime to
allow the call with the 'allow partially trusted callers' attribute.

I'd recommend removing the assembly from the GAC. Applying the APTC
attribute is a big responsibility.
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top