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

  • SEARCH
  • Home
  • 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 6818001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:07:24+00:00 2026-05-26T21:07:24+00:00

I recently came across Remote Validation in asp.net mvc . Really helpful feature but

  • 0

I recently came across Remote Validation in asp.net mvc. Really helpful feature but doesn’t adding something like this to a registration form, say to check for username or email, open up a security hole? Couldn’t someone use this to mine information from the site? Captca would be an obvious solution to this problem, but has anyone been able to integrate it with the [Remote] validation?

public class CreateUserModel : EditUserModel {
    [Required]
    [StringLength(6, MinimumLength = 3)]
    [Remote("IsUID_Available", "Validation")]
    [RegularExpression(@"(\S)+", ErrorMessage = "White space is not allowed.")]
    [Editable(true)]
    public override string UserName { get; set; }
}  
  • 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-26T21:07:24+00:00Added an answer on May 26, 2026 at 9:07 pm

    You could use a Captcha if you want. For example with Google’s ReCaptcha you could install the microsoft-web-helpers NuGet, sign up for a ReCaptcha account in order to obtain your private/public key pairs and then simply modify your view model so that when you perform the remote call the 2 additional fields are included:

    public class CreateUserModel : EditUserModel 
    {
        [Required]
        [StringLength(6, MinimumLength = 3)]
        [Remote("IsUID_Available", "Validation", AdditionalFields = "recaptcha_response_field,recaptcha_challenge_field", HttpMethod = "POST")]
        [RegularExpression(@"(\S)+", ErrorMessage = "White space is not allowed.")]
        [Editable(true)]
        public override string UserName { get; set; }
    }
    

    and in the view:

    @using Microsoft.Web.Helpers
    @model CreateUserModel
    @{
        ReCaptcha.PublicKey = "... public key obtained from Google ...";
    }
    
    <script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"></script>
    
    @using (Html.BeginForm())
    {
        @Html.EditorFor(x => x.UserName)
        @Html.ValidationMessageFor(x => x.UserName)
        @ReCaptcha.GetHtml(theme: "red")
        <button type="submit">OK</button>
    }
    

    and in the controller:

    [HttpPost]
    public ActionResult IsUID_Available(string username)
    {
        if (!ReCaptcha.Validate(privateKey: "... private key obtained from Google ..."))
        {
            return Json("sorry, please enter a correct Captcha first");
        }
    
        // TODO: the user entered a correct Captcha => you can proceed
        // into usrname existence verification:
        bool userExists = _repository.UserExists(username);
        return Json(userExists);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently came across pidgin . Its great, and does what I want, but I
I recently came across a ASP 1.1 web application that put a whole heap
I recently came across new way to generate random numbers in C++11, but couldn't
I recently came across this interesting term and searched on Net to know more
I recently came across a great data structures book, Data Structures Using C (c)
I recently came across Erlang, the programming language, and I've become interested in developing
I recently came across a Windows library called AHK that gives me great control
I recently came across a forum post in the android developers group. (link below)
I recently came across a question about sequence points in C++ at this site,
I recently came across a question somewhere: Suppose you have an array of 1001

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.