Welcome Guest Search | Active Topics | Sign In | Register

Assembly does not allow partially trusted callers. Options
dios
Posted: Tuesday, December 2, 2008 5:09:42 AM
Rank: Member
Groups: Member

Joined: 8/13/2008
Posts: 14
Hello All,

I recently uploaded a fully working webproject to a production server and since then, every page with an Essential Object fails with the following exception:

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

I've done some reading, and some resources tell that the third party assembly developers have to rewrite the assembly to add the following peace of code (in some kind of way):

AllowPartialllyTrustedCallers.

Can anybody help me? Help would be appreciated.

Thanks in advance,
Anthony Van den bossche
WebDev
eo_support
Posted: Tuesday, December 2, 2008 6:18:45 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,096
Hi,

We do have AllowPartialllyTrustedCallers in our code. Would you be able to provide the full stack trace for the error? You will need to set customError to "Off" in your web.config to get the full stack trace off a remote server.

Thanks!
dios
Posted: Tuesday, December 2, 2008 6:25:25 AM
Rank: Member
Groups: Member

Joined: 8/13/2008
Posts: 14
eo_support wrote:
Hi,

We do have AllowPartialllyTrustedCallers in our code. Would you be able to provide the full stack trace for the error? You will need to set customError to "Off" in your web.config to get the full stack trace off a remote server.

Thanks!


Here you go:

[SecurityException: That assembly does not allow partially trusted callers.]
EO.Web.Internal.g0.a(ControlCollection A_0, Control A_1) +0
EO.Web.Internal.a9..ctor(is A_0, Control A_1) +79
EO.Web.Editor.a(String[] A_0) +8391
EO.Web.Editor.a(Control A_0) +618
EO.Web.Editor.h(Control A_0) +131
EO.Web.Editor.CreateChildControls() +1866
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.Control.PreRenderRecursiveInternal() +44
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
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.elements_pageedit_aspx.ProcessRequest(HttpContext context) in App_Web_kz0g3umw.4.cs:0
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

Hopefully this helps.
eo_support
Posted: Tuesday, December 2, 2008 12:01:07 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,096
Hi,

Can you let us know which version you are using? We tested the latest version and it seems to be working fine.

Thanks!
dios
Posted: Wednesday, December 3, 2008 2:37:17 AM
Rank: Member
Groups: Member

Joined: 8/13/2008
Posts: 14
eo_support wrote:
Hi,

Can you let us know which version you are using? We tested the latest version and it seems to be working fine.

Thanks!


Hello,

i'm working with the latest version, downloadable on this site at this moment.

Cheers.
dios
Posted: Wednesday, December 3, 2008 2:44:19 AM
Rank: Member
Groups: Member

Joined: 8/13/2008
Posts: 14
dios wrote:
eo_support wrote:
Hi,

Can you let us know which version you are using? We tested the latest version and it seems to be working fine.

Thanks!


Hello,

i'm working with the latest version, downloadable on this site at this moment.

Cheers.


Hello,

my stacktrace issue disappeared suddenly today, without me doing anything...
I now got another problem with a fileexplorer. This is probably something I overlooked but the error:

System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

Stacktrace:
Quote:
[SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessPermission.Demand() +58
System.Reflection.Assembly.VerifyCodeBaseDiscovery(String codeBase) +118
System.Reflection.Assembly.GetName(Boolean copiedName) +70
System.Reflection.Assembly.GetName() +9
EO.Web.Internal.cx..cctor() +141
eo_support
Posted: Wednesday, December 3, 2008 5:42:52 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,096
Hi,

Your security setting is way too tight. You have turned off FileIOPermissionAccess.PathDiscovery, which is needed by many core features ---- including reading the license file. I believe you can restricts the permission to your application only, but you can not completely turn it off. So you will need to have your server administrator to turn it back on for you.

Thanks
dios
Posted: Monday, December 15, 2008 7:38:53 AM
Rank: Member
Groups: Member

Joined: 8/13/2008
Posts: 14
Hello,

i'm very sorry for my late reply but i've waited until now for an answer from my website hosting...

Short summary: i am using the Explorer control to allow users to view files they uploaded and ofcourse to upload files. The error I get is the following:

Quote:
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: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessPermission.Demand() +58
System.Reflection.Assembly.VerifyCodeBaseDiscovery(String codeBase) +118
System.Reflection.Assembly.GetName(Boolean copiedName) +70
System.Reflection.Assembly.GetName() +9
EO.Web.Internal.cx..cctor() +141




The hosting provider asked me if the control can run in Partially Trusted Environment (medium), because this is the way that server is configured. Is it possible to make the control work in this kind of environment?

Thanks in advance.

Anthony.
eo_support
Posted: Monday, December 15, 2008 7:51:29 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,096
Hi,

I do not believe your hoster understood the problem correctly. The situation is that they turned off "FileIOPermission", and you wish to access the files. Our controls does run on partial trust, but when you disallow file access on one hand and wish to access the files on the other hand, it just won't work. It doesn't matter whose product you use in this case. It won't work even if you write your own code. No code can access files when "FileIOPermission" is turned off. That is the designed behavior and if there were exception to that, it would have been a .NET security bug.

It's very reasonable for hoster to restrict file access, but most hosters allow full file access inside your own application's directory.

Thanks


dios
Posted: Tuesday, December 16, 2008 7:14:35 AM
Rank: Member
Groups: Member

Joined: 8/13/2008
Posts: 14
Hello,

de security config of the hosting provider is the following:

Quote:
<configuration>
<!--

$Id: vevida_net-2.0.config 5004 2008-11-17 08:18:26Z janreilink $

-->
<mscorlib>
<security>
<policy>
<PolicyLevel version="1">

<!-- Eerst definieren we alle classes die gebruikt gaan worden. -->

<SecurityClasses>
<SecurityClass Name="FirstMatchCodeGroup" Description="System.Security.Policy.FirstMatchCodeGroup, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<SecurityClass Name="UnionCodeGroup" Description="System.Security.Policy.UnionCodeGroup, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

<SecurityClass Name="AllMembershipCondition" Description="System.Security.Policy.AllMembershipCondition, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<SecurityClass Name="StrongNameMembershipCondition" Description="System.Security.Policy.StrongNameMembershipCondition, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<SecurityClass Name="UrlMembershipCondition" Description="System.Security.Policy.UrlMembershipCondition, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<SecurityClass Name="ZoneMembershipCondition" Description="System.Security.Policy.ZoneMembershipCondition, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

<SecurityClass Name="AspNetHostingPermission" Description="System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<SecurityClass Name="FileIOPermission" Description="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<SecurityClass Name="NamedPermissionSet" Description="System.Security.NamedPermissionSet"/>
<SecurityClass Name="SecurityPermission" Description="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<SecurityClass Name="OleDbPermission" Description="System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<SecurityClass Name="SqlClientPermission" Description="System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<SecurityClass Name="SmtpPermission" Description="System.Net.Mail.SmtpPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<SecurityClass Name="WebPermission" Description="System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<SecurityClass Name="OdbcPermission" Description="System.Data.Odbc.OdbcPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<SecurityClass Name="EnvironmentPermission" Description="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<SecurityClass Name="DnsPermission" Description="System.Net.DnsPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<SecurityClass Name="ReflectionPermission" Description="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</SecurityClasses>

<!-- Daarna komen de permission sets. -->

<NamedPermissionSets>

<!-- Alles: alles mag. -->

<PermissionSet
class="NamedPermissionSet"
version="1"
Unrestricted="true"
Name="Alles"
Description="Allows full access to all resources"
/>

<!-- Niks: niks mag. -->

<PermissionSet
class="NamedPermissionSet"
version="1"
Name="Niks"
Description="Denies all resources, including the right to execute"
/>

<!-- ASP.Net: permissies voor ASP.NET applicaties. -->

<PermissionSet
class="NamedPermissionSet"
version="1"
Name="ASP.Net">

<!-- ASP.NET mag gebruikt worden, zonder al te gevaarlijke dingen. -->

<IPermission
class="AspNetHostingPermission"
version="1"
Level="Medium"
/>

<!-- Code mag uitgevoerd worden. -->

<IPermission
class="SecurityPermission"
version="1"
Flags="Execution,ControlPrincipal,ControlThread,SerializationFormatter"
/>

<!-- In de eigen applicatiedirectory mag alles: inhoud opvragen en bestanden lezen, schrijven en aanpassen. -->

<IPermission
class="FileIOPermission"
version="1"
Read="$AppDir$"
PathDiscovery="$AppDir$"
Write="$AppDir$"
Append="$AppDir$"
/>

<IPermission class="OleDbPermission"
version="1"
Unrestricted="true"/>

<IPermission class="SqlClientPermission"
version="1"
Unrestricted="true"
/>

<IPermission class="SmtpPermission"
version="1"
Access="Connect"
/>

<IPermission class="WebPermission"
version="1"
Unrestricted="true"
/>

<IPermission class="OdbcPermission"
version="1"
Unrestricted="true"
/>

<IPermission
class="EnvironmentPermission"
version="1"
Read="COMPUTERNAME"
/>

<IPermission
class="DnsPermission"
version="1"
Unrestricted="true"
/>

<IPermission
class="ReflectionPermission"
version="1"
Flags="RestrictedMemberAccess"
/>
</PermissionSet>

</NamedPermissionSets>

<!-- En tenslotte vertellen we welke code welke permissionsets krijgt. -->

<!-- Alle code mag Niks :) -->

<CodeGroup
class="FirstMatchCodeGroup"
version="1"
PermissionSetName="Niks">

<IMembershipCondition
class="AllMembershipCondition"
version="1"
/>

<!-- Code in de virtual root directory van een applicatie mag ASP.NET. -->

<CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="ASP.Net">

<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="$AppDirUrl$/*"
/>
</CodeGroup>

<!-- Dynamisch gegenereerde code van een applicatie (bijv. het resultaat van een .aspx pagina) mag ASP.NET. -->

<CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="ASP.Net">

<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="$CodeGen$/*"
/>
</CodeGroup>

<!-- Code in de global assembly cache mag ASP.NET. -->

<CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="Alles">

<IMembershipCondition
class="UrlMembershipCondition"
Url="$Gac$/*"
version="1"
/>
</CodeGroup>

<!-- Code die ondertekend is met Microsofts of ECMAs keys mag Alles, voor zover deze op het systeem geinstalleerd is. -->

<CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="Niks">

<IMembershipCondition
class="ZoneMembershipCondition"
version="1"
Zone="MyComputer" />

<CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="Alles"
Name="Microsoft_Strong_Name"
Description="This code group grants code signed with the Microsoft strong name full trust. ">

<IMembershipCondition
class="StrongNameMembershipCondition"
version="1"
PublicKeyBlob="002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293"
/>
</CodeGroup>

<CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="Alles"
Name="Ecma_Strong_Name"
Description="This code group grants code signed with the ECMA strong name full trust. ">

<IMembershipCondition
class="StrongNameMembershipCondition"
version="1"
PublicKeyBlob="00000000000000000400000000000000"
/>
</CodeGroup>
</CodeGroup>
</CodeGroup>
</PolicyLevel>
</policy>
</security>
</mscorlib>
</configuration>


Maybe this helps?

Many thanks in advance,
Anthony.
eo_support
Posted: Tuesday, December 16, 2008 7:29:32 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,096
Hi,

Thanks for the additional information. From the stack trace, it appears that it fails when it calls Assembly.GetName(). The relative source code is:

typeof(EO.Web.WebControl).Assembly.GetName();

As a test, you can try this in your code and see how it works out.

Please keep in mind that we will not troubleshoot your security settings. We can tell you what permission our code needs but we will not be able to tell you why such permission is not granted giving your specific config file. You will need to troubleshoot that part by yourself.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.