Thursday, December 11, 2008

Not enough permissions. Inherit your page class from RadAjaxPage

I have been scratching my head for a few hours trying to figure out how to fix the following bug:
Finally - i figured it out ....

If you are trying out Telerik controls for the first time - you may get this. Or if your web host changes some of their configurations (which happened to me) you may also get this.

--------------------

Server Error in '/' Application.
Not enough permissions. Inherit your page class from RadAjaxPage if you are running under Medium trust level.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Not enough permissions.Inherit your page class from RadAjaxPage if you are running under Medium trust level.

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:
[InvalidOperationException: Not enough permissions.
Inherit your page class from RadAjaxPage if you are running under Medium trust level.]
Telerik.Web.UI.RadAjaxControl.AttachOnRender() +274


--------------------------

The fix is an obvious one. If you are reading this post, you probably did a search for this particular error. Once I figured it out - I felt pretty stupid, and I am a very experienced .Net programmer. I had made a database change (a small one) and then this error started happening... I couldnt figure out how my database change could have caused it.

My database change was not the culpret. The web host changing their trust/configuration settings was the problem.

To fix - I had to "read" the error.

--------------------------

VB.Net fix.....

Imports Telerik.Web.UI ' put at top of page

Partial Class MyShippingAccount
Inherits RadAjaxPage ' System.Web.UI.Page

C# fix....

using Telerik.Web.UI; // put at top of page


public partial class admin_ShipThis_modal : Telerik.Web.UI.RadAjaxPage //System.Web.UI.Page
{


No code-behind page? No problem...


<[percent-sign] @ Page Language="VB" Inherits="Telerik.Web.UI.RadAjaxPage" [percent-sign]>
<[percent-sign]@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" [percent-sign]>
---------------------------------------

Let me know it this helps.. I kept wondering if I broke something the whole time with my database change... and if Ajax components were complaining over it. But no. If you got this error - it is probably not your fault... and the fix is easy. I hope this saves you some head-scratching time.

2 comments:

  1. Haha, wow... I missed it too. Thanks to you're blog I was able to fix the error in about 3 minutes. Thank you so much for posting this.

    ReplyDelete
  2. HALP PLASE
    Not enough permissions.
    Inherit your page class from RadAjaxPage if you are running under Medium trust level.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidOperationException: Not enough permissions.
    Inherit your page class from RadAjaxPage if you are running under Medium trust level.

    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:


    [InvalidOperationException: Not enough permissions.
    Inherit your page class from RadAjaxPage if you are running under Medium trust level.]
    Telerik.Web.UI.RadAjaxControl.AttachOnRender() +289
    Telerik.Web.UI.RadAjaxControl.OnPagePreRenderComplete(Object sender, EventArgs e) +138
    System.EventHandler.Invoke(Object sender, EventArgs e) +0
    System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +9753946
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5054

    ReplyDelete