/// <summary> /// Initializes a new instance of the <see cref="T:System.Web.HttpApplication"/> class. /// </summary> static MvcApplication() { CookieCaptchaManager = new DefaultCaptchaManager(new CookieStorageProvider()); CookieCaptchaManager.ImageUrlFactory = (helper, pair) => helper.Action("Generate", "DefaultCaptcha", new RouteValueDictionary { { CookieCaptchaManager.TokenParameterName, pair.Key }, { CookieParameterKey, "t" } }); CookieCaptchaManager.RefreshUrlFactory = (helper, pair) => helper.Action("Refresh", "DefaultCaptcha", new RouteValueDictionary { { CookieParameterKey, "t" } }); }
private static ICaptchaManager CreateCaptchaManagerByNumber(int i) { var captchaManager = new DefaultCaptchaManager(new SessionStorageProvider()); captchaManager.ImageElementName += i; captchaManager.InputElementName += i; captchaManager.TokenElementName += i; captchaManager.ImageUrlFactory = (helper, pair) => { var dictionary = new RouteValueDictionary(); dictionary.Add(captchaManager.TokenParameterName, pair.Key); dictionary.Add(MultipleParameterKey, i); return helper.Action("Generate", "DefaultCaptcha", dictionary); }; captchaManager.RefreshUrlFactory = (helper, pair) => { var dictionary = new RouteValueDictionary(); dictionary.Add(MultipleParameterKey, i); return helper.Action("Refresh", "DefaultCaptcha", dictionary); }; return captchaManager; }
private static ICaptchaManager CreateCaptchaManagerByNumber(int i) { var captchaManager = new DefaultCaptchaManager(new SessionStorageProvider()); captchaManager.ImageElementName += i; captchaManager.InputElementName += i; captchaManager.TokenElementName += i; captchaManager.ImageUrlFactory = (helper, pair) => { var dictionary = new RouteValueDictionary(); dictionary.Add(captchaManager.TokenParameterName, pair.Key); dictionary.Add(MultipleParameterKey, i); return(helper.Action("Generate", "DefaultCaptcha", dictionary)); }; captchaManager.RefreshUrlFactory = (helper, pair) => { var dictionary = new RouteValueDictionary(); dictionary.Add(MultipleParameterKey, i); return(helper.Action("Refresh", "DefaultCaptcha", dictionary)); }; return(captchaManager); }