KingNET.PageLib/Helper/CookieHelper.cs
(开头部分) 6KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using DMSFrame.Security;
using KingNET.PageLib.Utils;
namespace KingNET.PageLib.Helper
{
/// <summary>
/// Cookie帮助类,有SOS加密,Escape加密(前台可解密),不加密三种写入方式
/// </summary>
public class CookieHelper
{
public static string _EncryptKey = "";
public static string EncryptKey
{
get
{
CookieHelper._EncryptKey = System.Configuration.ConfigurationManager.AppSettings["CookieEnctyptKey"];
if (CookieHelper._EncryptKey == null)
{
CookieHelper._EncryptKey = "wdweb";
}
return CookieHelper._EncryptKey;
}
}
public static void WriteCookie(string strName, string strValue)
{
HttpCookie httpCookie = HttpContext.Current.Request.Cookies[strName];
if (httpCookie == null)
{
httpCookie = new HttpCookie(strName);
}
httpCookie.Value = strValue;
HttpContext.Current.Response.AppendCookie(httpCookie);
}
public static void WriteCookie(string strName, string key, string strValue)
{
HttpCookie httpCookie = HttpContext.Current.Request.Cookies[strName];
if (httpCookie == null)
{
httpCookie = new HttpCookie(strName);
}
httpCookie[key] = strValue;
HttpContext.Current.Response.AppendCookie(httpCookie);
}
public static void WriteCookie(string strName, string strValue, int expires)
{
HttpCookie httpCookie = HttpContext.Current.Request.Cookies[strName];
if (httpCookie == null)
{
httpCookie = new HttpCookie(strName);
}
httpCookie.Value = strValue;
httpCookie.Expires = DateTime.Now.AddMinutes((double)expires);
HttpContext.Current.Response.AppendCookie(httpCookie);
}
后面还有 126 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。