Bot Detect Captcha 设置多种图像样式
Bot Detect Captcha Set multiple image styles
有没有办法为机器人检测验证码设置多个图像样式?
我指的是 this 示例。
我写了一个扩展class来初始化验证码,
public class CaptchaHelper
{
public static MvcCaptcha GetTicketsCaptcha()
{
// create the control instance
MvcCaptcha myCaptcha = new MvcCaptcha("ExampleCaptcha");
myCaptchaImageStyle = BotDetect.ImageStyle.AncientMosaic;
}
}
我可以设置一个样式,但找不到设置多个选项的方法。需要帮助吗?
有一种方法可以做到这一点,"CaptchaRandomization.GetRandomImageStyle" 接受 ImageStyle 数组。
ImageStyle[] allowedStyles =
{
ImageStyle.AncientMosaic,
ImageStyle.MeltingHeat,
ImageStyle.MeltingHeat2,
ImageStyle.Negative
};
myCaptcha.ImageStyle = CaptchaRandomization.GetRandomImageStyle(allowedStyles);
有没有办法为机器人检测验证码设置多个图像样式?
我指的是 this 示例。
我写了一个扩展class来初始化验证码,
public class CaptchaHelper
{
public static MvcCaptcha GetTicketsCaptcha()
{
// create the control instance
MvcCaptcha myCaptcha = new MvcCaptcha("ExampleCaptcha");
myCaptchaImageStyle = BotDetect.ImageStyle.AncientMosaic;
}
}
我可以设置一个样式,但找不到设置多个选项的方法。需要帮助吗?
有一种方法可以做到这一点,"CaptchaRandomization.GetRandomImageStyle" 接受 ImageStyle 数组。
ImageStyle[] allowedStyles =
{
ImageStyle.AncientMosaic,
ImageStyle.MeltingHeat,
ImageStyle.MeltingHeat2,
ImageStyle.Negative
};
myCaptcha.ImageStyle = CaptchaRandomization.GetRandomImageStyle(allowedStyles);