Web/Class/Session.cs

(开头部分) 7KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.HtmlControls;

namespace Web.Class
{
    public class Session
    {
        #region 验证码session
        /// <summary>
        /// 设置验证码Session
        /// </summary>
        /// <param name="verifyCode">验证字符串</param>
        public static void SetVerifyCode(string verifyCode)
        {

            if (!string.IsNullOrEmpty(verifyCode))
               HttpContext.Current.Session["ValidateCode"] = verifyCode;
        }
        /// <summary>
        /// 获取验证码字符串
        /// </summary>
        /// <param name="verifyCode"></param>
        /// <returns>验证码</returns>
        public static string GetVerifyCode()
        {
            if (HttpContext.Current.Session["ValidateCode"]!=null)
                return HttpContext.Current.Session["ValidateCode"].ToString();
            return string.Empty;
        }
        #endregion

        #region 登录后的session

          #region 管理员session

        /// <summary>
        /// 获取管理员ID Session
        /// </summary>
        public static string GetHId(string hid)
        {
            if (HttpContext.Current.Session["HID"] != null)
                return HttpContext.Current.Session["HID"].ToString();
            return string.Empty;
        }

        /// <summary>
        /// 设置管理员ID Session
        /// </summary>
        public static void SetHId(int? hid)
        {
            if(hid!=null)
                HttpContext.Current.Session["HID"] = hid.ToString();
        }

        /// <summary>
        /// 获取管理员账号Session
        /// </summary>
后面还有 183 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。