0

I want to call a method from view written in the controller using image tags in the Asp.net mvc project. What should I do?

Below is my HTML code written in View:

@using (Html.BeginForm("LoginSuccess", "Login", FormMethod.Post))
 {
   @Html.AntiForgeryToken()
      <form>
   <p><img src="/Login/ShowCaptchaImage" /></p>
                                                <p>Please enter the string as shown above:</p>
                                                <p>@Html.TextBox("CaptchaText")</p>
                                                <strong>@ViewBag.Message</strong>
   </form>
}

I want to call ShowCaptchaImage() method on login page load.

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
Ajit
  • 1
  • 1

1 Answers1

1

This has been answered in similar Stackoverflow question. There are demos and how to implement is also available there.

How to implement reCaptcha for ASP.NET MVC?

Is your requirements different from this? Or Missed that resources?

Mohan
  • 81
  • 4
  • -------This img tag not working for me for calling ShowCaptchaImage() action method written in Login controller – Ajit Jun 10 '20 at 11:51