Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7653943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:09:12+00:00 2026-05-31T12:09:12+00:00

Can anyone explain how to have reCaptcha functionality like stackoverflow in my MVC3 application.

  • 0

Can anyone explain how to have reCaptcha functionality like stackoverflow in my MVC3 application.

And how can you customize that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T12:09:14+00:00Added an answer on May 31, 2026 at 12:09 pm

    I use the Google ReCaptcha and it works very well and is very simple to implement.

    Note that if you are using Https be sure you have the current version of the dll (1.0.5.0 at this time)

    You need to create an account on the Google Recaptcha site and get a set of public and private keys. Add the keys to your web project main web.config file:

    <appSettings>
        <add key="webpages:Version" value="1.0.0.0"/>
        <add key="ClientValidationEnabled" value="true"/>
        <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
        <add key="ReCaptchaPrivateKey" value="put your private key value here" />
        <add key="ReCaptchaPublicKey" value="put your public key value here" />
    </appSettings>
    

    Now use NuGet and install the reCAPTCHA plugin for .NET

    Then, go to your web.config file inside of your VIEWS folder. Add this line:

    <namespaces>
      <add namespace="System.Web.Mvc" />
      <add namespace="System.Web.Mvc.Ajax" />
      <add namespace="System.Web.Mvc.Html" />
      <add namespace="System.Web.Routing" />
      <add namespace="Recaptcha"/>
    </namespaces>
    

    Then, in your view that you want to show the captcha, add the using statement at the top of your file

    @using Recaptcha;
    

    then add this to your view:

    <div class="editor-label">
        Are you a human?
    </div>
    <div class="editor-field">
        @Html.Raw(Html.GenerateCaptcha("captcha", "clean"))
        @Html.ValidationMessage("captcha")
    </div>
    

    In your controller action you will need to modify the signature to accept the captcha results:

    [HttpPost]
    [RecaptchaControlMvc.CaptchaValidator]
    public ActionResult ForgotPassword(CheckUsernameViewModel model, bool captchaValid, string captchaErrorMessage) {
        if (!Membership.EnablePasswordReset)
            throw new Exception("Password reset is not allowed\r\n");
        if(ModelState.IsValid) {
            if(captchaValid) {
                return RedirectToAction("AnswerSecurityQuestion", new { username = model.Username });
            }
            ModelState.AddModelError("", captchaErrorMessage);
        }
        return View(model);
    }
    

    Following those steps have allowed me to implement captcha on several pages and it works smoothly. Note that the parameter names on the controller action MUST BE NAMED CORRECTLY:

    bool captchaValid, string captchaErrorMessage
    

    If you changed these parameter names you WILL get an error at runtime when your form posts back to the controller action.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone explain how to create friendly URLs? I mean URLs like http://store.steampowered.com/app/22600/ that
Can anyone explain how javascript trackers (like the code that Google Analytics and Click,
Can anyone explain me about each term that I have used in working with
Can anyone explain if it is possible to have a web server for all
Can anyone explain what advantages there are to using a tool like MSBuild (or
can anyone explain me what happen here?? i have this html code: <div class=calculadora>
I'd like to know if someone can explain why the following occurs: I have
Can anyone explain to me how to verify mocks if you don't have their
In CSS, display can have values of inline and inline-block . Can anyone explain
I'm confused by these two warnings. Can anyone explain how I might have come

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.