Reputation: 217
Is there a way to set multiple image style for bot detect captcha?
I am referring to this sample.
I have written an extension class to initialize captcha,
public class CaptchaHelper
{
public static MvcCaptcha GetTicketsCaptcha()
{
// create the control instance
MvcCaptcha myCaptcha = new MvcCaptcha("ExampleCaptcha");
myCaptchaImageStyle = BotDetect.ImageStyle.AncientMosaic;
}
}
I can set one style, but cannot find a way to set multiple options. Need some help?
Upvotes: 0
Views: 847
Reputation: 8616
There is a way to do this, "CaptchaRandomization.GetRandomImageStyle" accepts ImageStyle array.
ImageStyle[] allowedStyles =
{
ImageStyle.AncientMosaic,
ImageStyle.MeltingHeat,
ImageStyle.MeltingHeat2,
ImageStyle.Negative
};
myCaptcha.ImageStyle = CaptchaRandomization.GetRandomImageStyle(allowedStyles);
Upvotes: 1