Rendering a control generates security exception in .Net 4

Posted by Jason Short on Stack Overflow See other posts from Stack Overflow or by Jason Short
Published on 2010-05-04T19:16:08Z Indexed on 2010/05/04 19:18 UTC
Read the original article Hit count: 511

Filed under:
|
|
|

I am having a problem with code that worked fine in .Net 2 giving this error under .Net 4.

Build (web): Inheritance security rules violated while overriding member: 'Controls.RelatedPosts.RenderControl(System.Web.UI.HtmlTextWriter)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.

This is in DotNetBlogEngine. There were several other security demands in the code that .Net 4 didn't seem to like. I followed some of the advice I found on blogs (and here) and got rid of all the other errors. But this one still eludes me.

The Main blogengine core dll is not set for security demands anylonger and is compiled for .Net 4 as well.

This error is in the website side attempting to use the dll. There are controls that call a RenderControl method taking an HtmlTextWriter. Apparently the text writer now has some soft of security attributes set on it.

Each of the controls implements a custom interface ( public interface ICustomFilter ), there are no security permissions present or demands. The site is running full trust on my local dev machine.

© Stack Overflow or respective owner

Related posts about blogengine.net

Related posts about ASP.NET