This project is read-only.

SessionStorageProvider Class GetValue method always returns false as ValidateKeys is null

Oct 24, 2016 at 2:32 PM
/// <summary>
/// Gets an <see cref="ICaptchaValue" /> associated with the specified token.
/// </summary>
/// <param name="token">The specified token.</param>
/// <param name="tokenType">The specified token type.</param>
/// <returns>
/// An instance of <see cref="ICaptchaValue" />.
/// </returns>
public virtual ICaptchaValue GetValue(string token, TokenType tokenType)
        Validate.ArgumentNotNullOrEmpty(token, "token");
        ICaptchaValue value;
        LogWriter.Info("CaptchaMVC: GetValue > Token :" + token + " TokenType : (1 for Drawing, 2 for Validation) " + tokenType.ToString());
        switch (tokenType)
            case TokenType.Drawing:
                if (DrawingKeys.TryGetValue(token, out value))
            case TokenType.Validation:
                if (ValidateKeys.TryGetValue(token, out value))
                throw new ArgumentOutOfRangeException("tokenType");
        if (value == null)
            LogWriter.Info("CaptchaMVC: GetValue > Value is null.");
            LogWriter.Info("CaptchaMVC: GetValue > Value is not null CaptchaText: " + value.CaptchaText + " and Value: " + value.Value);
        return value;

In my development server, Captcha is always returned "Wrong Captcha entered".
Above code always returns null (because ValidateKeys is null) which causes "Wrong captcha entered" message. It is working fine in my local while debugging and IIS but not working on Development server.
Is there any specific thing which I need to take care on the server?

Nikunj Patel