前台
<img id=\"vcodeimg\" src=\"/Home/VCode\" width=\"70\"
height=\"25\" />
<span
style=\"cursor: pointer; text-decoration: underline\">换一张</span>
控制器
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Utility;
using Jellal**;
namespace sjlwebsite.Controllers
{
public class CommonController : Controller
{
#region 验证码
[OutputCache(Duration = 0)]
public ActionResult VCode()
{
string code = ValidateCode.CreateRandomCode(4);
Session[\"vcode\"] = code;
ValidateCode.CreateImage(code);
return View();
}
public string GetCode()
{
return Session[\"vcode\"].ToStr();
}
#endregion
}
}
本文地址:https://www.stayed.cn/item/9884
转载请注明出处。
本站部分内容来源于网络,如侵犯到您的权益,请 联系我