/// <summary> /// 验证码生成 /// </summary> /// <param name="publicKey">验证码ID</param> /// <param name="privateKey">验证码KEY</param> /// <returns></returns> public static string GetCaptcha(string publicKey, string privateKey) { GeetestLib geetest = new GeetestLib(publicKey, privateKey); string gtServerStatus = geetest.preProcess("test").ToString(); new CookieHelper(GeetestLib.gtServerStatusSessionKey, gtServerStatus); return(geetest.getResponseStr()); }
private string GetCaptcha(HttpContext context) { var geetest = new GeetestLib("7f8cfbad6525535e637bcb59a20550f8", "ae62d001e558b9dfca3e4c4f40032fcd"); var gtServerStatus = geetest.preProcess(); context.Session[GeetestLib.gtServerStatusSessionKey] = gtServerStatus; return(geetest.getResponseStr()); }
private string getCaptcha() { GeetestLib geetestLib = new GeetestLib(SettingsManager.GetMasterSettings().GeetestKey, SettingsManager.GetMasterSettings().GeetestId); string userID = "mec"; byte b = geetestLib.preProcess(userID); HiCache.Insert("gt_server_status", b); return(geetestLib.getResponseStr()); }
private String getCaptcha() { GeetestLib geetest = new GeetestLib(_geetestOptions.Id, _geetestOptions.Key); String userID = "test"; Byte gtServerStatus = geetest.preProcess(userID); // Session[GeetestLib.gtServerStatusSessionKey] = gtServerStatus; // Session["userID"] = userID; return(geetest.getResponseStr()); }
private String getCaptcha() { GeetestLib geetest = new GeetestLib(GeetestConfig.publicKey, GeetestConfig.privateKey); String userID = "test"; Byte gtServerStatus = geetest.preProcess(userID); Session[GeetestLib.gtServerStatusSessionKey] = gtServerStatus; Session["userID"] = userID; return(geetest.getResponseStr()); }
/// <summary> /// 获取滑动验证码 /// </summary> /// <returns></returns> public ActionResult GetCaptcha() { GeetestLib geetest = new GeetestLib(publicKey, privateKey); string userID = "test"; Byte gtServerStatus = geetest.preProcess(userID, "web", Request.UserHostAddress); Session[GeetestLib.gtServerStatusSessionKey] = gtServerStatus; Session["userID"] = userID; return(Content(geetest.getResponseStr())); }
public ActionResult GetCaptcha() { GeetestLib geetest = new GeetestLib(GeetestConfig.publicKey, GeetestConfig.privateKey); string userID = RandomUtil.CreateRandomStr(10); byte gtServerStatus = geetest.preProcess(userID, "web", ConfigurationManager.AppSettings["ClientIP"]); Session[GeetestLib.gtServerStatusSessionKey] = gtServerStatus; Session["userID"] = userID; return(Content(geetest.getResponseStr())); }
private String getCaptcha(HttpContext context) { GeetestLib geetest = new GeetestLib("48a6ebac4ebc6642d68c217fca33eb4d", "4f1c085290bec5afdc54df73535fc361"); String userID = "test"; Byte gtServerStatus = geetest.preProcess(userID, "web", "127.0.0.1"); context.Session[GeetestLib.gtServerStatusSessionKey] = gtServerStatus; context.Session["userID"] = userID; return(geetest.getResponseStr()); }
private String getCaptcha() { GeetestLib geetest = new GeetestLib("b46d1900d0a894591916ea94ea91bd2c", "36fc3fe98530eea08dfc6ce76e3d24c4"); String userID = "test"; Byte gtServerStatus = geetest.preProcess(userID); Session[GeetestLib.gtServerStatusSessionKey] = gtServerStatus; Session["userID"] = userID; return(geetest.getResponseStr()); }
public ApiResponse GenerateCode() { Context.Response.ContentType = "application/json"; GeetestLib geetest = new GeetestLib(GeetestConfig.publicKey, GeetestConfig.privateKey); string appKey = System.Guid.NewGuid().ToString(); Byte gtServerStatus = geetest.preProcess(appKey); Context.Session[GeetestLib.gtServerStatusSessionKey] = gtServerStatus; Context.Session["sessionID"] = appKey; return(ResponseHelper.CreateApiResponse(10000, "success", geetest.getResponseStr())); }
public ActionResult GetCaptcha() { var geetest = new GeetestLib( ConfigurationManager.AppSettings["CheckCode.GeetestLib.PublicKey"], ConfigurationManager.AppSettings["CheckCode.GeetestLib.PrivateKey"]); var userCheckCode = Guid.NewGuid().ToString(); var gtServerStatus = geetest.preProcess(userCheckCode); Session[GeetestLib.gtServerStatusSessionKey] = gtServerStatus; Session["userCheckCode"] = userCheckCode; return(Content(geetest.getResponseStr())); }
public void TestGetCaptcha() { var config = new ConfigurationBuilder() .AddJsonFile("Configuration.json") .Build(); GeetestLib geetest = new GeetestLib(config["GeetestId"], config["GeetestKey"]); String userID = config["GeetestUserId"]; Byte gtServerStatus = geetest.preProcess(userID); Assert.Equal(gtServerStatus, (Byte)1); Console.WriteLine(geetest.getResponseStr()); }
public static string GeetestInit(string GeetestId) { string str = string.Empty; try { IsoDateTimeConverter timeFormat = new IsoDateTimeConverter(); timeFormat.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; string GeetestPublicKey = System.Configuration.ConfigurationManager.AppSettings["GeetestPublicKey"]; string GeetestPrivateKey = System.Configuration.ConfigurationManager.AppSettings["GeetestPrivateKey"]; GeetestLib geetest = new GeetestLib(GeetestPublicKey, GeetestPrivateKey); Byte gtServerStatus = geetest.preProcess(GeetestId); string returnStr = geetest.getResponseStr(); str = ResponseHelper.ResponseMsg("1", "取数成功", returnStr); } catch (Exception ex) { str = ResponseHelper.ResponseMsg("-1", ex.Message, ""); } return(str); }