我正在使用这个 这个 我的 MVC 项目中的 Recaptcha 方法,但它无法验证 Strict 1.0 DOCTYPE。
有人可以帮忙吗?
谢谢
I am using this this Recaptcha approach in my MVC project however it does not validate to Strict 1.0 DOCTYPE.
Can anyone help?
Thanks
我会通过 NuGet 包参考推荐 Microsoft Web Helpers 库。
这是一篇博客文章: http://www.dotnetcurry.com/ShowArticle.aspx?ID =611
I would recommend the Microsoft Web Helpers library through NuGet package reference.
Here is a blog post: http://www.dotnetcurry.com/ShowArticle.aspx?ID=611
创建您自己的控件。正如您在 RecaptchaControl 的 RenderContents 方法中看到的,它使用 iframe。 iframe 不严格符合 HTML,因此您必须使用 HTML 对象标记。
protected override void RenderContents(HtmlTextWriter output) { output.AddAttribute(HtmlTextWriterAttribute.Type, "text/javascript"); output.RenderBeginTag(HtmlTextWriterTag.Script); output.Indent++; output.WriteLine("var RecaptchaOptions = {"); output.Indent++; output.WriteLine("theme : '{0}',", this.theme ?? string.Empty); if (this.customThemeWidget != null) { output.WriteLine("custom_theme_widget : '{0}',", this.customThemeWidget); } output.WriteLine("tabindex : {0}", this.TabIndex); output.Indent--; output.WriteLine("};"); output.Indent--; output.RenderEndTag(); output.AddAttribute(HtmlTextWriterAttribute.Type, "text/javascript"); output.AddAttribute(HtmlTextWriterAttribute.Src, this.GenerateChallengeUrl(false), false); output.RenderBeginTag(HtmlTextWriterTag.Script); output.RenderEndTag(); output.RenderBeginTag(HtmlTextWriterTag.Noscript); output.Indent++; output.AddAttribute(HtmlTextWriterAttribute.Src, this.GenerateChallengeUrl(true), false); output.AddAttribute(HtmlTextWriterAttribute.Width, "500"); output.AddAttribute(HtmlTextWriterAttribute.Height, "300"); output.AddAttribute("frameborder", "0"); output.RenderBeginTag(HtmlTextWriterTag.Iframe); // Change this to object HTML tag output.RenderEndTag(); output.WriteBreak(); output.AddAttribute(HtmlTextWriterAttribute.Name, "recaptcha_challenge_field"); output.AddAttribute(HtmlTextWriterAttribute.Rows, "3"); output.AddAttribute(HtmlTextWriterAttribute.Cols, "40"); output.RenderBeginTag(HtmlTextWriterTag.Textarea); output.RenderEndTag(); output.AddAttribute(HtmlTextWriterAttribute.Name, "recaptcha_response_field"); output.AddAttribute(HtmlTextWriterAttribute.Value, "manual_challenge"); output.AddAttribute(HtmlTextWriterAttribute.Type, "hidden"); output.RenderBeginTag(HtmlTextWriterTag.Input); output.RenderEndTag(); output.Indent--; output.RenderEndTag(); }
Create your own control. As you can see in the RenderContents method of the RecaptchaControl, it use an iframe. Iframe are not HTML strict compliant, thus you have to use a HTML object tag.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(2)
我会通过 NuGet 包参考推荐 Microsoft Web Helpers 库。
这是一篇博客文章: http://www.dotnetcurry.com/ShowArticle.aspx?ID =611
I would recommend the Microsoft Web Helpers library through NuGet package reference.
Here is a blog post: http://www.dotnetcurry.com/ShowArticle.aspx?ID=611
创建您自己的控件。正如您在 RecaptchaControl 的 RenderContents 方法中看到的,它使用 iframe。 iframe 不严格符合 HTML,因此您必须使用 HTML 对象标记。
Create your own control. As you can see in the RenderContents method of the RecaptchaControl, it use an iframe. Iframe are not HTML strict compliant, thus you have to use a HTML object tag.