I'm just starting to learn ASP.NET MVC and following an ASP.NET MVC tutorials.
I'm using Visual Studio Express 2013 RC for Web and think that could be the reason for my problem, because the tutorial for paging is written using VS2012.
Everything is works fine; but when I add paging to one of the pages, using all the instructions in the tutorial for adding PagedList.mvc, everything compiles fine; when I get to the specific page, I receive this error message:
Attempt by security transparent method
'PagedList.Mvc.HtmlHelper.PagedListPager(System.Web.Mvc.HtmlHelper, PagedList.IPagedList, System.Func
2) to access security critical type 'System.Web.Mvc.MvcHtmlString' failed.
Assembly 'PagedList.Mvc, Version=4.3.0.0, Culture=neutral,
enter code here PublicKeyToken=abbb863e9397c5e1' is marked with the AllowPartiallyTrustedCallersAttribute, and uses the level 2 security transparency model. Level 2 transparency causes all methods in AllowPartiallyTrustedCallers assemblies to become security transparent by default, which may be the cause of this exception.
Anybody can give some reason why this situation is happening? Many thanks in advance and bye ...
For me, the page was dying in the same way on Html.ActionLink
helpers:
Attempt by security transparent method 'Microsoft.Web.Mvc.LinkExtensions.ActionLink(System.Web.Mvc.HtmlHelper, System.Linq.Expressions.Expression
1<System.Action
1>, System.String, System.Object)' to access security critical type 'System.Web.Mvc.MvcHtmlString' failed.
The solution was to do the following:
Uninstall-Package Mvc4Futures
Then:
Install-Package Microsoft.AspNet.Mvc.Futures -Version 5.0.0
https://www.nuget.org/packages/Microsoft.AspNet.Mvc.Futures/5.0.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With