This is a simple to use Audio Captcha made for ASP.NET MVC
- jquery
- bootstrap
- SessionState must be enabled (default is)
- Add a reference to 'Pigi.Captcha.dll' to your project.
-
Register two httphandlers by adding these two lines to your webconfig at 'system.webserver' section:
<handlers> <add name="captcha" path="captcha.ashx" type="Pigi.Captcha.captcha,Pigi.Captcha" verb="*" preCondition="integratedMode"/> <add name="sayit" path="sayit.ashx" type="Pigi.Captcha.sayit,Pigi.Captcha" verb="*" preCondition="integratedMode"/> </handlers>
-
Also register routing ignore by adding this line to your 'routeConfig' file
routes.Ignore("{*legecy}", new { legecy = @".*\.(aspx|ashx|asmx|axd|svc)([/\?].*)?" });
- Make sure that you added packages 'NAudio' and 'NAudio.Lame' to your project and see if these two dlls are included in bin folder : 'libmp3lame.64.dll' 'libmp3lame.32.dll' They are used for audio compression purpose.
-
Add
@using Pigi.Captcha
to the top of your view.cshtml -
Add this helper method to generate Audio Captcha.
@Html.Captcha(new CaptchaSettings { Id = "c1" })
you can also customize more by setting 'CaptchaSettings' object properties, like image size, captcha style, enabling captcha user input...