This is a migrated thread and some comments may be shown as answers.

Security Exception

6 Answers 136 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Doug
Top achievements
Rank 1
Doug asked on 13 Nov 2008, 01:15 AM
I am deploying a site on a hosted server that uses RadControls for ASPNET AJAX Q3 2008.  Everything runs fine locally.  The site is throwing the error below after the RadGrid runs through OnNeedDataSource.

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: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

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.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) +150
   System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) +100
   System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action, Boolean throwException) +284
   System.Security.PermissionSetTriple.CheckSetDemand(PermissionSet demandSet, PermissionSet& alteredDemandset, RuntimeMethodHandle rmh) +69
   System.Security.PermissionListSet.CheckSetDemand(PermissionSet pset, RuntimeMethodHandle rmh) +150
   System.Security.PermissionListSet.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet) +30
   System.Threading.CompressedStack.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet) +40
   System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant, CompressedStack securityContext) +123
   System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant) +54


Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053


Any help would be appreciated.

6 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 13 Nov 2008, 07:50 AM
Hi Doug,

Can you provide a bit more info about this application trust level?

Sincerely yours,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Doug
Top achievements
Rank 1
answered on 13 Nov 2008, 03:19 PM
Vlad,

Here is what the server administrator had to say about the trust level.

All websites under .NET 2.0/3.0/3.5 run under a custom trust level, derived from the Medium trust level. In addition to all allowed through Medium trust, we allow OLEDB and ODBC functionality. If you’re using the latest version of the control from Telerik, it should be working.

 

That being said, I did some research and have tweaked some permissions on the site, granting NETWORK SERVICE access to the assembly. I’m not sure which page was giving you trouble, but please try again and let me know whether or not it’s working.

Update:
After a bit of testing, I have narrowed it down to 2 things.  If I remove the AllowPaging property from the grid, it works fine.  I also receive the same error if I try to sort by clicking on one of the colums.  Grid markup below.

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False"
 Width="500px"
 OnNeedDataSource="RadGrid1_NeedDataSource"
 PageSize="25"
 AllowSorting="True" AllowPaging="true" GridLines="None">
 <MasterTableView DataKeyNames="OrderId">
   <Columns>
     <telerik:GridTemplateColumn>
     <ItemTemplate>
       <asp:LinkButton ID="lbtnEdit" runat="server"></asp:LinkButton>
     </ItemTemplate>
     </telerik:GridTemplateColumn>
     <telerik:GridBoundColumn DataField="ShowName" HeaderText="Show" SortExpression="ShowName"></telerik:GridBoundColumn>
     <telerik:GridBoundColumn DataField="Amount" HeaderText="Amount" SortExpression="Amount"></telerik:GridBoundColumn>
     <telerik:GridBoundColumn DataField="Status" HeaderText="Status" SortExpression="Status"></telerik:GridBoundColumn>
   </Columns>
 </MasterTableView>
</telerik:RadGrid>


Thanks,
Doug

 

0
Doug
Top achievements
Rank 1
answered on 14 Nov 2008, 02:03 AM

Any ideas on how to get past this error?  I do not have access to set the trust level, but may be allowed to set some other site related permission. 

 

Any assistance would be appreciated.

 

Thanks,

 

Doug

0
Vlad
Telerik team
answered on 14 Nov 2008, 07:38 AM
Hi Doug,

Please send us the problematic page declaration via support ticket. I will test your scenario under medium trust and I will let you know about the result.

Regards,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Eric Niemiec
Top achievements
Rank 1
answered on 27 Apr 2009, 03:55 PM
This has to do with the Telerik.Web.UI.Dll, Telerik.Web.UI.XML,Telerik.Web.Design.dll being blocked when you copy them over to your server.  Unblock them and cycle the apppool and it should work.  it did for us.
0
Doug
Top achievements
Rank 1
answered on 27 Apr 2009, 04:38 PM
The host upgraded the Framework version on the web server to 3.5 in my case.  The host admin adjusted a few of the security settings and everything is working now.  Thanks for your input.

Doug
Tags
Grid
Asked by
Doug
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Doug
Top achievements
Rank 1
Eric Niemiec
Top achievements
Rank 1
Share this question
or