I am working on captcha authentication. I want to get user entered captcha value in controller's Index method. Below is my cshtml
file code
@{
ViewData["Title"] = "Home Page";
}
<div >
<label for="captcha"><b>Enter chaptcha - </b></label>
<label id="lblshowCaptcha"><b>@ViewData["captcha"]</b></label>
<input id="txtCapValue" type="text" placeholder="Enter captcha" name="cap" required>
<br/>
<button type="submit">Login</button>
<br />
</div>
When user entering captcha value in txtCapValue
and click submit button I need that value in controller. Here is my controller
public IActionResult Index()
{
randnumber = RandomString(6);
ViewData["captcha"] = randnumber;
return View();
}
how can I get txtCapValue input
control value when user click on submit
button ?
CodePudding user response: