SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission'

Mar 18, 2011 at 12:57 PM

Hello everyone,

 

I am hosting my application at server that only allow Medium trust security and I use MVCSiteMap v 2.3.0 since this is the one that allows AllowPartiallyTrustedCallers.

But I get an error like below:

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.Web.AspNetHostingPermission, System, 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.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   MvcSiteMapProvider.Internal.MvcSiteMapProviderViewEngine..cctor() in MvcSiteMapProviderViewEngine.cs:25

 

Could anyone help me with this?

 

Thank you,

Best Regards,

Ronald Wisnu Hariyanto

Mar 21, 2011 at 11:48 PM

Anyone can help me with this?

Or if there is no other way to use MVCSiteMap in the medium trust hosting environment, please let me know.

I have tried adding the [assembly: AllowPartiallyTrustedCallers] to the AssemblyInfo.cs but the problem still occurs.

Thank you,

Best Regards,

Ronald Wisnu Hariyanto

Coordinator
Mar 25, 2011 at 10:18 PM

Can you disable the static MvcSiteMapProviderViewEngine() static constructor just to test? The latest sources contain a fix for this.

Jun 27, 2011 at 9:58 PM

I have the same problem and I can not solve it.

Coordinator
Jun 29, 2011 at 12:37 PM

Can you disable the static MvcSiteMapProviderViewEngine() static constructor just to test?