This project is read-only.

Captcha image not showing for views in area

May 5, 2013 at 12:53 PM
Edited May 5, 2013 at 12:55 PM
hi all,
This captchaMVC does not work when added in views in area section.i have download all the source project from CodePlex and run it .it works fine.but when i add area and add a view in it.when i add a captcha and run the project,go to the area show no image, only inputbox and refresh button are shown.please check it .
May 5, 2013 at 1:58 PM
Hi there,
I added an example of use captcha with areas here.
This code adds support for the areas:
protected void Application_Start()

    var defaultCaptchaManager = (DefaultCaptchaManager)CaptchaMvc.Infrastructure.CaptchaUtils.CaptchaManager;
    defaultCaptchaManager.ImageUrlFactory = (helper, pair) => ImageUrlFactory(defaultCaptchaManager, helper, pair);
    defaultCaptchaManager.RefreshUrlFactory = RefreshUrlFactory;

private string RefreshUrlFactory(UrlHelper urlHelper, KeyValuePair<string, ICaptchaValue> keyValuePair)
    return urlHelper.Action("Refresh", "DefaultCaptcha", new { area = "" });

private string ImageUrlFactory(DefaultCaptchaManager captchaManager, UrlHelper urlHelper, KeyValuePair<string, ICaptchaValue> keyValuePair)
    return urlHelper.Action("Generate", "DefaultCaptcha",
                            new RouteValueDictionary
                                    {"area", ""},
                                    {captchaManager.TokenParameterName, keyValuePair.Key}
Vyacheslav Volkov
May 5, 2013 at 5:40 PM
Many Many thanks for your is working perfectly.How can i add validationmessagefor to hold the error when text does not match?How can active clientvalidation on captcha so that client validation will perform before server validation.Please help me ,it is urgent.