reCAPTCHA功能与MVC3和剃须刀? [英] Using ReCaptcha with MVC3 and razor?

查看:215
本文介绍了reCAPTCHA功能与MVC3和剃须刀?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正是你如何获得的reCAPTCHA工作MVC3剃刀?我试过安装封装微软网络助手,但仍无法得到它到我的.cshtml剃须刀页面上工作,它找不到类型验证码。而且,在<一个href=\"http://nuget.org/List/Packages/microsoft-web-helpers\">http://nuget.org/List/Packages/microsoft-web-helpers有人留下评论说:这个包目前与WebMatrix中唯一的。虽然这篇文章表明它可能工作<一个href=\"http://www.dotnetcurry.com/ShowArticle.aspx?ID=611\">http://www.dotnetcurry.com/ShowArticle.aspx?ID=611

How exactly do you get ReCaptcha work in MVC3 with razor? I tried "Install-Package microsoft-web-helpers" but still could not get it to work on my .cshtml razor page, it cannot find the type ReCaptcha. And, on http://nuget.org/List/Packages/microsoft-web-helpers someone left comment saying "This package currently works with WebMatrix only". While this article shows it may work http://www.dotnetcurry.com/ShowArticle.aspx?ID=611

推荐答案

您可能需要做出的 Microsoft.Web.Helpers提供的意见命名空间。在你的web.config(一个在你的查看文件夹)地址:

You might need to make the Microsoft.Web.Helpers namespace available to the views. In your web.config (the one in your Views folder) add:

<namespaces>
    <!-- other namespaces here -->
    <add namespace="Microsoft.Web.Helpers"/>
</namespaces>

然后你可以用下面的助手在您的视图:

Then you can use the following helper in your view:

@ReCaptcha.Validate([publick key])

如果该命名空间设置不起作用,你可以尝试将在视图顶部的 @using Microsoft.Web.Helpers 语句,看看是否有帮助。 F IT做,你必须设法找出为什么在web.config中的命名空间的设置是不工作...

If the namespaces setting doesn't work, you could try adding a @using Microsoft.Web.Helpers statement on top of the view to see if that helps. f it does, you'll have to try and find out why the namespace setting in the web.config isn't working...

这篇关于reCAPTCHA功能与MVC3和剃须刀?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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