当我添加谷歌验证码然后有问题 [英] When I add google capcha then there is problem with it

查看:79
本文介绍了当我添加谷歌验证码然后有问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我在我的网站上使用过Google recapcha,它在localhost中可以正常工作.但是,当我将其上传到服务器时,它存在一些问题,并且显示了这样的异常

Hello,

I have used google recapcha in my website and it works fine in localhost. But when I upload it on server then there is some problem with it and it shows exception like this

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: That assembly does not allow partially trusted callers.

Source Error: 


Line 67:                 <div class="co_capcha">
Line 68:                     <asp:Label Visible="false" ID="lblResult" runat="server" CssClass="label_display" />
Line 69:                     <recaptcha:RecaptchaControl ID="recaptcha"  runat="server" Theme="white" PublicKey="my public key"
Line 70:                         PrivateKey="my private key" />
Line 71:                 </div>

推荐答案

问题的根本原因是它可以在中等信任模式下运行-进行较小的更改后允许部分受信任的呼叫者.当您应用AllowPartiallyTrustedCallers(APTCA)时,它表示可以从部分受信任的代码中调用程序集. .NET 4框架中有关APTCA的有趣更新在2010年3月MSDN问题 http://msdn中列出. microsoft.com/en-us/magazine/ee336023.aspx. [ ^ ]

通过对所有入口点完全信任的隐式链接要求,可以保护所有已签名的程序集免受部分信任的调用者的侵害.这意味着任何尝试访问强命名程序集的部分受信任的代码都将因安全异常而失败.这样可以防止从部分信任中恶意调用(可能是危险的)完全信任的代码.

像本文中那样为您的程序集声明APTCA并不困难: http://support.microsoft.com/kb/839300 [^ ]
Root cause for the problem is that it can run in Medium trust mode - once a minor change is made to allow partially trusted callers. When you apply AllowPartiallyTrustedCallers (APTCA), it marks assembly can be called from partially trusted code. Interesting updates on APTCA in .NET 4 framework, is listed at March 2010 MSDN issue http://msdn.microsoft.com/en-us/magazine/ee336023.aspx.[^]

All signed assemblies were protected from partially trusted callers by implicit link demands for full trust on all entry points. This meant any partially trusted code attempting to access a strong-named assembly would fail with a security exception. This prevented (potentially dangerous) fully trusted code from being called maliciously from partial trust.

It''s not difficult to declare APTCA for your assembly like in this article: http://support.microsoft.com/kb/839300[^]


这篇关于当我添加谷歌验证码然后有问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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