Search code examples
asp.netasp.net-ajaxajaxcontroltoolkitsecurityexception

asp.Net post back security error


My web application presents a very strange error:

    Server Error in '/' Application.
    --------------------------------------------------------------------------------

    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 failed.

    Source Error: 


    [No relevant source lines]


    Source File: c:\windows\Microsoft.NET\Framework\v4.0.21006\Temporary ASP.NET Files\root\9d105d0f\5a29f9f\App_Web_w324g3dv.1.cs    Line: 0 

    Stack Trace:   

[SecurityException: Request failed.] 

  AjaxControlToolkit.HTMLEditor.EditPanel.set_ActiveMode(ActiveModeType value) in C:\Users\Machta\Documents\Visual Studio 10\Projects\AjaxControlToolkit_9c860ac12ae9\Server\AjaxControlToolkit\HTMLEditor\EditPanel.cs:400
   AjaxControlToolkit.HTMLEditor.EditPanel.LoadPostData(String postDataKey, NameValueCollection postCollection) in C:\Users\Machta\Documents\Visual Studio 10\Projects\AjaxControlToolkit_9c860ac12ae9\Server\AjaxControlToolkit\HTMLEditor\EditPanel.cs:142
   AjaxControlToolkit.ScriptControlBase.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) in C:\Users\Machta\Documents\Visual Studio 10\Projects\AjaxControlToolkit_9c860ac12ae9\Server\AjaxControlToolkit\ExtenderBase\ScriptControlBase.cs:426
   System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +8766531

...

It occurs only when I publish it on the server (which is fine, provided it's a security exception).

What is strange about it is that the application requires a permission to access a file that is supposed to be located in a folder on my computer. But this folder doesn't exist on my computer. When I reinstalled Visual Studio I also moved the project to a different folder (with similar name but it's still a different folder).

So my questions are:

  1. Why the application needs the file on my computer when its on the server?
  2. And why it works on my computer when the file shouldn't be here either?
  3. What can be the possible causes and solutions?

You can try it here: http://machta.aspone.cz/editor/webConntentEditor.aspx. User name: machta password:123456

I should also add that this error appears after every postback but the page loads fine.


Solution

  • Maybe the trust-level of your server is lowered by default.
    Try to add the following lines to your web.config

    <system.web>
        <trust level="Full"  />
    </system.web>
    

    Source