This project is read-only.

Routes causing image to fail....

Feb 20, 2013 at 8:33 AM
Edited Feb 20, 2013 at 8:35 AM
My MVC Razor site is set up the following way.>

Where user is the user id of the customer and section is one of five menu options.
So as follows....

To achieve this I have a route set up as follows....
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = " " }
I believe this is causing a problem for the MVC plugin because I think my route is overriding the captcha image path that is generated since it has the same URL structure as the above links.

Basically I'm getting a 404 in the page for the following:
Does this make any sense?
Mar 7, 2013 at 12:41 PM
Hi there,

Sorry for the late reply. Yes it may break the url that Captcha generates.
In order to control this, you can override methods to generate url, this is default implementation:
public class CapchaManager : DefaultCaptchaManager

    #region Overrides of DefaultCaptchaManager

    protected override string GenerateImageUrl(UrlHelper urlHelper, KeyValuePair<string, ICaptchaValue> captchaPair)
        return urlHelper.Action("Generate", "DefaultCaptcha",
                                        new RouteValueDictionary { { TokenParameterName, captchaPair.Key } });

    protected override string GenerateRefreshUrl(UrlHelper urlHelper, KeyValuePair<string, ICaptchaValue> captchaPair)
        return urlHelper.Action("Refresh", "DefaultCaptcha");

and then put this code when the application starts:
CaptchaUtils.CaptchaManager = new CapchaManager();
Vyacheslav Volkov
May 5, 2013 at 12:42 PM
Thanks Vyacheslav Volkov.
Actually your above example does not work.Please check it for views in area section.It show the following compile error

'CaptchaMvc.Infrastructure.DefaultCaptchaManager' does not contain a constructor that takes 0 arguments.can you please review it and update with proper solution for views in area section.