using Microsoft.AspNetCore.Http; using Znyc.Recruitment.Admin.Commons.Extensions; namespace Znyc.Recruitment.Admin.Commons.Helpers { /// /// Session帮助类,可在非controler中读取或保存session /// public static class SessionHelper { /// /// public static HttpContext HttpHelper => HttpContextHelper.HttpContext; /// /// 设置 Session /// /// /// public static void SetSession(string key, object value) { HttpHelper.Session.Set(key, value); } /// /// 获取 Session /// /// /// /// public static T GetSession(string key) { return HttpHelper.Session.Get(key); } /// /// 获取 Session /// /// /// public static string GetString(string key) { return HttpHelper.Session.GetString(key); } } }