views:

38

answers:

1

My ASP.NET web site works fine in development/debug mode, but when I publish it, I'm getting the following error:

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.

I've googled for this error, and it comes up plenty, and ll the answers say the same thing: put

<trust level="Full" originUrl=""/>

in the web.config file.

Ya, ya, ya. Thing is, I've checked that this line is in every web.config file I could find - the app itself, plus the framework\version\config\web.config files, both 32- and 64-bit (I'm running Windows 7).

There must be another secret switch somewhere - but what?

EDIT

At the request of a commenter, let me clarify: the page that causes the crash has a control from the AJAX Control Toolkit. If I comment out the ToolkitScriptManager and CalendarExtender controls, the page works fine, even under IIS.

Error stack trace (in case it helps):

[SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Reflection.Assembly._GetType(String name, Boolean throwOnError, Boolean ignoreCase) +0
System.Web.UI.NamespaceTagNameToTypeMapper.GetControlType(String tagName, IDictionary attribs, Boolean throwOnError) +209
System.Web.UI.TagPrefixTagNameToTypeMapper.System.Web.UI.ITagNameToTypeMapper.GetControlType(String tagName, IDictionary attribs) +210
System.Web.UI.MainTagNameToTypeMapper.GetControlType2(String tagName, IDictionary attribs, Boolean fAllowHtmlTags) +242
System.Web.UI.MainTagNameToTypeMapper.GetControlType(String tagName, IDictionary attribs, Boolean fAllowHtmlTags) +17
System.Web.UI.RootBuilder.GetChildControlType(String tagName, IDictionary attribs) +22
System.Web.UI.ControlBuilder.CreateChildBuilder(String filter, String tagName, IDictionary attribs, TemplateParser parser, ControlBuilder parentBuilder, String id, Int32 line, VirtualPath virtualPath, Type& childType, Boolean defaultProperty) +119
System.Web.UI.TemplateParser.ProcessBeginTag(Match match, String inputText) +605
System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) +1334
A: 

Found the answer!

Shaul