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.SecurityEx ception: 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.But ton1_Click (Object sender, EventArgs e) in E:\HighLimits.aspx.vb:119
System.Web.UI.WebControls. Button.OnC lick(Event Args e) +111
System.Web.UI.WebControls. Button.Rai sePostBack Event(Stri ng eventArgument) +110
System.Web.UI.WebControls. Button.Sys tem.Web.UI .IPostBack EventHandl er.RaisePo stBackEven t(String eventArgument) +10
System.Web.UI.Page.RaisePo stBackEven t(IPostBac kEventHand ler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePo stBackEven t(NameValu eCollectio n postData) +36
System.Web.UI.Page.Process RequestMai n(Boolean includeStagesBeforeAsyncPo int, Boolean includeStagesAfterAsyncPoi nt) +6785
System.Web.UI.Page.Process Request(Bo olean includeStagesBeforeAsyncPo int, Boolean includeStagesAfterAsyncPoi nt) +242
System.Web.UI.Page.Process Request() +80
System.Web.UI.Page.Process RequestWit hNoAssert( HttpContex t context) +21
System.Web.UI.Page.Process Request(Ht tpContext context) +49
ASP.rrsolutions_highlimits _aspx.Proc essRequest (HttpConte xt context) +37
System.Web.CallHandlerExec utionStep. System.Web .HttpAppli cation.IEx ecutionSte p.Execute( ) +181
System.Web.HttpApplication .ExecuteSt ep(IExecut ionStep 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.
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.SecurityEx
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.But
System.Web.UI.WebControls.
System.Web.UI.WebControls.
System.Web.UI.WebControls.
System.Web.UI.Page.RaisePo
System.Web.UI.Page.RaisePo
System.Web.UI.Page.Process
System.Web.UI.Page.Process
System.Web.UI.Page.Process
System.Web.UI.Page.Process
System.Web.UI.Page.Process
ASP.rrsolutions_highlimits
System.Web.CallHandlerExec
System.Web.HttpApplication
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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\F ramework\v 2.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.
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\F
* 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.
http://blogs.msdn.com/shawnfa/archive/2005/02/04/367390.aspx
http://support.microsoft.com/kb/839300