zoukankan      html  css  js  c++  java
  • session

    using System.Web;
    
    namespace RM.Common.DotNetBean
    {
        public class RequestSession
        {
            private static string SESSION_USER = "SESSION_USER";
            private static string SESSION_COMPANY = "SESSION_COMPANY";
    
            public static void AddSessionUser(SessionUser user)
            {
                HttpContext rq = HttpContext.Current;
                rq.Session[RequestSession.SESSION_USER] = user;
            }
                
    
            public static SessionUser GetSessionUser()
            {
                HttpContext rq = HttpContext.Current;
                return (SessionUser)rq.Session[RequestSession.SESSION_USER];
            }
            public static void AddSessionCompany(SessionCompany company)
            {
                HttpContext rq = HttpContext.Current;
                rq.Session[RequestSession.SESSION_COMPANY] = company;
            }
            public static SessionCompany GetSessionCompany()
            {
                HttpContext rq = HttpContext.Current;
                return (SessionCompany)rq.Session[RequestSession.SESSION_COMPANY];
            }
        }
    }

    调用方法

     model.companyid = RequestSession.GetSessionCompany().CompanyId.ToString();

  • 相关阅读:
    django rest_framework中将json输出字符强制为utf-8编码
    Java
    Java
    Oracle
    IDEA
    Ubuntu
    Ubuntu
    Ubuntu
    Ubuntu
    Oracle
  • 原文地址:https://www.cnblogs.com/hellowzd/p/4441343.html
Copyright © 2011-2022 走看看