source/Repid.MvcExtension/SessionFactory.cs

(开头部分) 3KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using Repid.Entity.Basic;
using Repid.Core.Aop;

namespace Repid.MvcExtension
{
    public static class SessionFactory
    {
        const string SessionUserIDKey = "REPID-MANAGE-USERID";
        const string SessionUserNameKey = "REPID-MANAGE-USERNAME";
        const string SessionUserRoleKey = "REPID-MANAGE-USERROLE";
        const string SessionIsSuperKey = "REPID-MANAGE-ISSUPER";

        /// <summary>
        /// 用户编号
        /// </summary>
        public static string UserID
        {
            get
            {
                var obj = HttpContext.Current.Session[SessionUserIDKey];

                if (obj != null)
                {
                    return obj.ToString();
                }
                else { return string.Empty; }
            }
            set { HttpContext.Current.Session[SessionUserIDKey] = value; }
        }

        /// <summary>
        /// 用户账号
        /// </summary>
        public static string UserName
        {
            get
            {
                var obj = HttpContext.Current.Session[SessionUserNameKey];

                if (obj != null)
                {
                    return obj.ToString();
                }
                else { return string.Empty; }
            }
            set { HttpContext.Current.Session[SessionUserNameKey] = value; }
        }

        /// <summary>
        /// 用户角色
        /// </summary>
        public static string UserRole
        {
            get
            {
后面还有 61 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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