Custom captcha Image not rendering when Integrated with sitecore

Viewed 968

I am trying to render custom captcha in asp.net mvc pages using captchamvc library from nuget as below.

@Html.Captcha("Refresh", "Enter_the_text_shown_in_image", 5, "Is required field.", false)

But instead of getting an image, this is what i get.

custom captcha

Please suggest.

1 Answers
  • check that CaptchaMvc.xml is deployed enter image description here
  • make sure that image url generared by captchamvc ("/DefaultCaptcha/Generate?t=0784d3c58d09456b84b03552f8caea4e") in not being processed by sitecore routes and mapped to wrong destination. You can add separate route for this url:
routes.MapRoute(name: "CaptchaMvcRoute", url: "DefaultCaptcha/Generate", defaults: new { controller = "DefaultCaptcha", action = "Generate" });
  • try to add to web.config:
<configuration>
   <location path="DefaultCaptcha/Generate">
       <system.web>
         <authorization>
           <allow users="?" />
         </authorization>
       </system.web>
   </location>
</configuration>

Black square with red cross is an error bitmap of captchaMvc.

Related