//6位数验证码:
Random rm =
new Random();
string str = rm.Next(
100000,
1000000).ToString();
//MVC控制器Action中 保存session值
System.Web.HttpContext.Current.Session[
"Code"] = str;
//MVC控制器Action中 读取session值
string SessingStr = System.Web.HttpContext.Current.Session[
"Code"].ToString();
转载于:https://www.cnblogs.com/SeNaiTes/p/8916065.html