//获取session中key对应的value
public static string GetSession(string name)
{
if (HttpContext.Current.Session[name] != null)
{
return HttpContext.Current.Session[name].ToString();
}
else
{
return "";
}
}
//存储key对应的value
public static void SetSession(string name, string value)
{
HttpContext.Current.Session[name]=value;
}
前台存储:
document.cookie = 'timeStamp=' + event.timeStamp + '; path=/;';
后台获取:
HttpCookie timeStamp = HttpContext.Current.Request.Cookies["timeStamp"];
string timestamp = timeStamp.Value.ToString();
Session和Cookie存储获取参数
最新推荐文章于 2023-02-03 01:06:08 发布