生成验证码的代码还是一致

这里只是说返回到view层的代码
创建actionresult方法,返回一个FileContentResult类型的结果,
然后图片连接就像普通url连接一样
比如<img src="/AA/GetValidateCode/code">

public ActionResult GetValidateCode(string code)
        {
            ValideCode vCode = new ValideCode();

            string plaincode = CryptTo.CustomerDecode(code);
            byte[] bytes = vCode.CreateValidateGraphic(plaincode);

            return File(bytes, @"image/jpeg");
        }

本文使用Blog_Backup未注册版本导出,请到soft.pt42.com注册。

相关文章:

  • 2022-01-26
  • 2021-12-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-12
  • 2021-05-14
  • 2021-08-01
  • 2021-09-23
  • 2021-10-06
  • 2022-02-17
相关资源
相似解决方案