Captcha Mvc [Storage provider]
To store captcha values used interface IStorageProvider, its definition is:
/// <summary> /// Represents the storage to save a captcha tokens. /// </summary> public interface IStorageProvider { /// <summary> /// Adds the specified token and <see cref="ICaptchaValue"/> to the storage. /// </summary> /// <param name="captchaPair">The specified <see cref="KeyValuePair{TKey,TValue}"/></param> void Add(KeyValuePair<string, ICaptchaValue> captchaPair); /// <summary> /// Gets the <see cref="ICaptchaValue"/> associated with the specified token. /// </summary> /// <param name="token">The token of the value to get.</param> /// <returns>When this method returns, contains the value associated with the specified token, ///if the token is found; otherwise, return <c>null</c> value.</returns> ICaptchaValue GetDrawingValue(string token); /// <summary> /// Gets the <see cref="ICaptchaValue"/> associated with the specified token. /// </summary> /// <param name="token">The token of the value to get.</param> /// <returns>When this method returns, contains the value associated with the specified token, /// if the token is found; otherwise, return <c>null</c> value.</returns> ICaptchaValue GetValidationValue(string token); }
GetDrawingValue method returns a value for rendering captcha for a given token.
GetDrawingValue method returns a value of captcha validation for a given token.
By default, in all implementations values deleted after the first of its request.
You are available the two implementations:
- CookieStorageProvider - uses a cookie to store the captcha values.
- SessionStorageProvider - uses the session to store the captcha values.
protected void Application_Start() { CaptchaUtils.CaptchaManager.StorageProvider = new CookieStorageProvider(); ..............
Hi,
Where does the captcha store state? In local cache? If i want to change the storage, from local cache to distributed cache, is there a way to configure it or do I have to implement the IStorageProvider?
Thanks,
Martin