Machta
Machta

Reputation: 2186

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.

Upvotes: 0

Views: 1156

Answers (2)

ChrisLively
ChrisLively

Reputation: 88044

First off, it's not requesting a file on your computer. It's just telling you the name of the file (and location) that was compiled and the relevant line of code that failed.

The PDB's store this information at the time the application is compiled which is why the reference is to a location on your harddrive.

If that referenced location is no longer valid then it sounds like you haven't deployed the whole app to the server since you moved your local source.

All of that said, what does line 400 or your EditPanel do? If it's trying to write a file to a location on the web server then you need to make sure that the user the app is executing under has writes to do this. hint: look at the application pool settings.

Upvotes: 0

David Rettenbacher
David Rettenbacher

Reputation: 5120

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

Upvotes: 2

Related Questions