This is a migrated thread and some comments may be shown as answers.

[Solved] Medium Trust Issue with the Menu

7 Answers 57 Views
Menu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
James
Top achievements
Rank 1
James asked on 17 Feb 2010, 05:55 AM
I am attempting to use the MVC Menu control on a Medium Trust host (GoDaddy) and I'm running into a security exception. Here is some code that defines a menu and causes the issue:

<
   Html.Telerik().Menu() 
       .Name("TheMenu") 
       .Items(items => 
                  { 
                      items.Add() 
                          .Text("Home") 
                          .Action("Index", "Home"); 
                  }).Render(); 
%> 

If I remove that code and run the app, everything works, including the Telerik MVC Grid. With that code present, I get the exception shown below. Also note that I have turned OFF compression of scripts/css.

[SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutralPublicKeyToken=b77a5c561934e089' failed.] 
   System.Reflection.Assembly._GetExportedTypes() +0 
   System.Reflection.Assembly.GetExportedTypes() +16 
   Telerik.Web.Mvc.Infrastructure.Implementation.<>c__DisplayClassb.<GetAllControllerTypes>b__9(Assembly assembly) +16 
   Telerik.Web.Mvc.Extensions.EnumerableExtensions.Each(IEnumerable`1 instance, Action`1 action) +146 
   Telerik.Web.Mvc.Infrastructure.Implementation.ControllerTypeCache.GetAllControllerTypes() +169 
   Telerik.Web.Mvc.Infrastructure.Implementation.ControllerTypeCache.EnsureInitialized() +72 
   Telerik.Web.Mvc.Infrastructure.Implementation.ControllerTypeCache.GetControllerTypeWithinNamespaces(String controllerName, IEnumerable`1 namespaces) +42 
   Telerik.Web.Mvc.Infrastructure.Implementation.ControllerTypeCache.GetControllerType(RequestContext requestContext, String controllerName) +191 
   Telerik.Web.Mvc.Infrastructure.Implementation.AuthorizeAttributeCache.GetAuthorizeAttributes(RequestContext requestContext, String controllerName, String actionName) +113 
   Telerik.Web.Mvc.Infrastructure.Implementation.ControllerAuthorization.IsAccessibleToUser(RequestContext requestContext, String controllerName, String actionName) +98 
   Telerik.Web.Mvc.Infrastructure.Implementation.NavigationItemAuthorization.IsAccessibleToUser(RequestContext requestContext, INavigatable navigationItem) +212 
   Telerik.Web.Mvc.UI.Menu.WriteItem(MenuItem item, IMenuRenderer renderer) +53 
   Telerik.Web.Mvc.UI.<>c__DisplayClass4.<WriteHtml>b__3(MenuItem item) +57 
   Telerik.Web.Mvc.Extensions.EnumerableExtensions.Each(IEnumerable`1 instance, Action`1 action) +146 
   Telerik.Web.Mvc.UI.Menu.WriteHtml(HtmlTextWriter writer) +235 
   Telerik.Web.Mvc.UI.ViewComponentBase.Render() +83 
   Telerik.Web.Mvc.UI.ViewComponentBuilderBase`2.Render() +22 
   ASP.views_shared_menu_ascx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in d:\...\...\Views\Shared\Menu.ascx:5 
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256 
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19 
   System.Web.UI.Control.Render(HtmlTextWriter writer) +10 
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134 
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19 
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29 
   System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +57 
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785 
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242 
   System.Web.UI.Page.ProcessRequest() +80 
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21 
   System.Web.UI.Page.ProcessRequest(HttpContext context) +49 
   System.Web.Mvc.ViewPage.ProcessRequest(HttpContext context) +62 
   System.Web.Mvc.ViewUserControlContainerPage.ProcessRequest(HttpContext context) +106 
   System.Web.Mvc.ViewPage.RenderView(ViewContext viewContext) +370 
   System.Web.Mvc.ViewUserControl.RenderViewAndRestoreContentType(ViewPage containerPage, ViewContext viewContext) +74 
   System.Web.Mvc.ViewUserControl.RenderView(ViewContext viewContext) +64 
   System.Web.Mvc.WebFormView.RenderViewUserControl(ViewContext context, ViewUserControl control) +68 
   System.Web.Mvc.WebFormView.Render(ViewContext viewContext, TextWriter writer) +118 
   System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection) +271 
   System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper htmlHelper, String partialViewName) +49 
   ASP.views_shared_site_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in d:\hosting\5307213\html\scheduletest\Views\Shared\Site.Master:37 
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256 
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19 
   System.Web.UI.Control.Render(HtmlTextWriter writer) +10 
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134 
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19 
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29 
   System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +57 
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785 
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242 
   System.Web.UI.Page.ProcessRequest() +80 
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21 
   System.Web.UI.Page.ProcessRequest(HttpContext context) +49 
   System.Web.Mvc.ViewPage.ProcessRequest(HttpContext context) +62 
   ASP.views_home_login_aspx.ProcessRequest(HttpContext context) in App_Web_vulfrjop.3.cs:0 
   System.Web.Mvc.<>c__DisplayClass1.<ProcessRequest>b__0() +38 
   System.Web.Mvc.<>c__DisplayClass4.<Wrap>b__3() +12 
   System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Func`1 func) +38 
   System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Action action) +66 
   System.Web.Mvc.ServerExecuteHttpHandlerWrapper.ProcessRequest(HttpContext context) +72 
   System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +1116 

7 Answers, 1 is accepted

Sort by
0
Kazi Manzur Rashid
Telerik team
answered on 17 Feb 2010, 05:24 PM
Hi James,

ASP.NET MVC requires reflection permission are your sure GoDaddy does have this permission? The Reflection permission is by default added if .NET 2.5 SP1 is installed. Can you pls provide us the medium trust config file of Godaddy so that we can cross check.

Greetings,
Kazi Manzur Rashid
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
James
Top achievements
Rank 1
answered on 17 Feb 2010, 05:48 PM
Hey Kazi,

According to this GoDaddy support page (http://help.godaddy.com/article/1039):

"Applications operating under a Medium trust level have no registry access, no access to the Windows event log, and cannot use ReflectionPermission (but can use Reflection). "....

Please note however that the ASP.NET MVC framework is running just fine. Here are the significant dependencies I've got in my app:

- ASP.NET MVC RC2
- The latest release of the Telerik ASP.NET MVC tools (BETA 2009.3.1320). 
- NHibernate 2.1.2 GA (using the documented changes to operate in Medium Trust). 

As I noted in my original post, the site is all working as expected except for the Telerik MVC Menu. That includes MVC RC2, NHibernate, and the Telerik MVC Grid. Obviously those dependencies use reflection and are working in that Medium Trust environment, so it seems like something is different in the Menu control. 

I don't have the GoDaddy config specifics about how they've setup Medium Trust (and they don't publish it), but I will see if I can get that information from them and post it here if they'll provide it.

Thanks
0
Kazi Manzur Rashid
Telerik team
answered on 18 Feb 2010, 08:12 AM
Hi James,

Please use the atached build to diagnosis the issue in GoDaddy.Note that this is a private build and not at all officially supported.

Sincerely yours,
Kazi Manzur Rashid
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
James
Top achievements
Rank 1
answered on 18 Feb 2010, 12:06 PM
Hey Kazi,

Thanks, but is it possible to give me a version of this built against ASP.NET MVC 2 RC2. Sorry, I excluded that this was ASP.NET MVC 2 in previous posts, it was not intentional. 

For what it's worth, here was the comforting response I got from GoDaddy:

"
Unfortunately, as previously stated, we will not be able to supply the requested information. If you are experiencing an error concerning the Trust Level of your coding or third party application, you will need to ensure that everything is configured to properly operate under a Medium Trust Level. If you require different specifications, you may wish to consider moving to a Virtual Dedicated or Dedicated hosting environment.
"
0
Accepted
Kazi Manzur Rashid
Telerik team
answered on 18 Feb 2010, 12:39 PM
Hello James,

Here is the MVC2 version.

Kind regards,
Kazi Manzur Rashid
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
James
Top achievements
Rank 1
answered on 18 Feb 2010, 03:12 PM
Kazi,

That version fixes the problem - no exception thrown. Thanks. Is there anything specific you want me to look at/verify with that version?

Thanks again. I really appreciate the quick and helpful support on this forum!
0
Kazi Manzur Rashid
Telerik team
answered on 18 Feb 2010, 05:43 PM
Hi James,

Great.

Kind regards,
Kazi Manzur Rashid
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Menu
Asked by
James
Top achievements
Rank 1
Answers by
Kazi Manzur Rashid
Telerik team
James
Top achievements
Rank 1
Share this question
or