Common/DoSession.cs

(开头部分) 2KB

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

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.SessionState;


        /// Session操作类
        /// <summary>
        /// Session操作类
        /// </summary>
public class DoSession:System.Web.UI.Page

{
             
            /// 添加Session,调动有效期默认为60分钟
            /// <summary>
            /// 添加Session,调动有效期默认为60分钟
            /// </summary>
            /// <param name="strSessionName">Session对象名称</param>
            /// <param name="strValue">Session值</param>
            public static void Add(string strSessionName, string strValue)
            {
                HttpContext.Current.Session[strSessionName] = strValue;
                HttpContext.Current.Session.Timeout = 60;
            }
            /// 添加Session
            /// <summary>
            /// 添加Session
            /// </summary>
            /// <param name="strSessionName">Session对象名称</param>
            /// <param name="strValue">Session值</param>
            /// <param name="iExpires">调动有效期(分钟)</param>
            public static void Add(string strSessionName, string strValue, int iExpires)
            {
                HttpContext.Current.Session[strSessionName] = strValue;
                HttpContext.Current.Session.Timeout = iExpires;
            }

            /// 读取某个Session对象值
            /// <summary>
            /// 读取某个Session对象值
            /// </summary>
            /// <param name="strSessionName">Session对象名称</param>
            /// <returns>Session对象值</returns>
            public static string Get(string strSessionName)
            {
                if (HttpContext.Current.Session[strSessionName] == null)
                {
                    return "";
                }
                else
                {
                    return HttpContext.Current.Session[strSessionName].ToString();
                }
            }

            /// 删除某个Session对象
            /// <summary>
            /// 删除某个Session对象
后面还有 15 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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