// GET: Code /// <summary> /// 验证码接口 /// </summary> /// <param name="codeLength">验证码长度</param> /// <returns></returns> /// 测试数据:/Code?codeLength=4 public ActionResult Index(int?codeLength = 4) { CodeServer codeServer = new CodeServer(); string strCode = codeServer.GetStrCode(codeLength); Session["Code"] = strCode; return(File(codeServer.GetCode(strCode).ToArray(), "image/jpeg")); }