Link to home
Start Free TrialLog in
Avatar of kblackwel
kblackwel

asked on

System.Security.SecurityException: That assembly does not allow partially trusted callers

I'm hoping someone can shed some light on an issue for me.

I have a working site. ASP, VB, running on network solutions IIS shared server.

So I was asked to move the site to a different network solutions site. They are bot nsHosting accounts. Looking int he account, they seem the same.

Well, when I copy of the files, I'm getting this error.

 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:

Line 117:            Response.Write(ex.ToString)
Line 118:        End Try
Line 119:    End Sub
Line 120:
Line 121:    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click


Source File: HighLimits.aspx.vb    Line: 119

Stack Trace:

[SecurityException: That assembly does not allow partially trusted callers.]
   RRSolutions_HighLimits.Button1_Click(Object sender, EventArgs e) in E:\HighLimits.aspx.vb:119
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242
   System.Web.UI.Page.ProcessRequest() +80
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
   System.Web.UI.Page.ProcessRequest(HttpContext context) +49
   ASP.rrsolutions_highlimits_aspx.ProcessRequest(HttpContext context) +37
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75


1st, I find it weird that it works on the same hosting platform till I move it to this new account.

As a test I moved it to and IIS account we have with ixwebhosting. Changed the names of the hard coded directories and worked immediately.

network solutions says you must right code for partial trust when I email them, but they wont say why it's not complaining on one server and not the other.

Any help would be appreciated.
ASKER CERTIFIED SOLUTION
Avatar of knuttelmarc
knuttelmarc

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

I have checked and found that you are getting problem because your application require full trust permission to run from the server but due to security reason your hosting provider can't provide you the full trust permission hence I would suggest you that please recompile your .dll in to medium trust level and upload it on server and after that the problem should be automatically resolved for you. To covert application into medium trust do the following steps on your testing server:

* Open C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config file in notepad
* Change location allowOverride="True" to location allowOverride="false"
* trust level="Full" originUrl="" to trust level="Medium" originUrl=""

Your hosting provider will not provide you full trust permssion on WIndows 2003 server with IIS6 in any situation because full trust means:

1 EventLogPermission is available. This means you can access the Windows event log.
2 ReflectionPermission is available. This means you can use reflection.
3 RegistryPermission is available. This means you can access the registry.
4 WebPermission is unrestricted. This means your application can communicate any address or range of addresses that you define in the element.
5 FileIOPermission is unrestricted. This means you can access any file of system. Your application is granted Read, Write, Append, and PathDiscovery permissions on system files.
6 You can call unmanaged code or from using Enterprise Services.

If your hosting provider have Windows 2008 server with IIS7 then update him to move your website on that server because IIS7 have Full trust permission feature without affecting the server. He can easily provide you full trust on Windows 2008 server.