渲染控制生成.NET 4的安全异常 [英] Rendering a control generates security exception in .Net 4

查看:164
本文介绍了渲染控制生成.NET 4的安全异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有code的一个问题,在.NET 2.0的罚款,但.NET 4中下给这个错误。

I am having a problem with code that worked fine in .NET 2.0 but is giving this error under .Net 4.

生成(网):继承安全   而重写规则违反   会员:   Controls.RelatedPosts.RenderControl(System.Web.UI.HtmlTextWriter)。   的安全访问   压倒一切的方法必须符合   该方法的安全访问   被重写。

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.

这是在DotNetBlogEngine。有在code其他一些安全要求.NET 4.0中似乎并不喜欢。我跟一些我发现博客(在这里),并摆脱了所有其他错误的建议。但是,这一次仍然逃避我。

This is in DotNetBlogEngine. There were several other security demands in the code that .NET 4.0 doesn'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.

主BlogEngine核心 DLL 未设置安全要求的任何时间更长,编译为.NET 4.0为好。

The Main BlogEngine core dll is not set for security demands any longer and is compiled for .NET 4.0 as well.

此错误是在网页端尝试使用 DLL 。有迹象表明,所谓的 RenderControl 方法服用的HtmlTextWriter 控件。显然,文字的作家现在已经在其上设置安全属性的一些软。

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.

每个控件实现一个自定义接口(公共接口ICustomFilter ),不存在任何安全权限present或要求。该网站是在我的本地开发机器上运行的充分信任。

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.

更新:

我在.NET 4试图在安全命名空间中的各种设置I <一href="http://weblogs.asp.net/asptest/archive/2010/04/23/what-is-new-in-asp-net-4-0-$c$c-access-security.aspx"相对=nofollow>这里阅读。我知道这是一个code访问安全性的变化,但我不明白的,为什么它背后不工作(或错误信息)。

I have tried the various settings under the security namespace in .NET 4 I read about here. I know this is a code access security change, but I don't understand the why behind it not working (or the error message).

推荐答案

设置该属性 [总成:SecurityRules(SecurityRuleSet.Level1)]

Set this attribute [assembly: SecurityRules(SecurityRuleSet.Level1)]

REF: http://msdn.microsoft。 COM / EN-US /库/ dd233102%28VS.100%29.aspx

这篇关于渲染控制生成.NET 4的安全异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆