本文介绍了如何在asp.net应用程序中获取会话中的Cookie值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在另一个页面的加载事件中获取Session中的两个值
HttpCookie upsceducook = new HttpCookie(userinfo);
upsceducook [username] = uname;
upsceducook [userid] = check.Single()。Id.ToString();
upsceducook.Expires = DateTime .Now.AddYears(1);
Response.Cookies.Add(upsceducook);
I want to get Both value in Session at another page's Load Event
HttpCookie upsceducook = new HttpCookie("userinfo");
upsceducook["username"] = uname;
upsceducook["userid"] = check.Single().Id.ToString();
upsceducook.Expires = DateTime.Now.AddYears(1);
Response.Cookies.Add(upsceducook);
推荐答案
if(Request.Cookies["userinfo"]!=null)
{
var value=Request.Cookies["userinfo"].Value;
}
这篇关于如何在asp.net应用程序中获取会话中的Cookie值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!