如何在aspx中读取session的值 就是在aspx.cs给session添加了一个值 如何在aspx页面中读取出来 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Session["session1"] = "111"; Session["session2"] = "222"; Label1.Text = Session["session1"].ToString(); Label2.Text = Session["session2"].ToString(); } } 如果你是在Web.config中作的如:void Application_Start(object sender, EventArgs e){ Application["total"] = 0; }在default.aspx.cs中也可以应用: protected void Page_Load(object sender, EventArgs e) { this.Label1.Text = Application["total"].ToString(); }记得加分呀! Session["session"] = "value"; 设置Session["UserName"]=this.txtUname.Text; 读取this.Label1.Text=Session["UserName"].ToString(); 在aspx页面用<%=Session["sessionname"]%> 为什么page.ClientScript.RegisterStartupScript在net3.5下这个就不能用了 用window.open打开子页面时,如何每次都重新加载子页面,而不是读取历史页面 用户控件的问题 程序与独立的数据库的安全困惑 静态网页可以分页吗? Session的奇怪问题。 在线签名 2级域名解析的调用,急,求大神。 javascript怎样传递参数? 从 viewer里面导入一个报表,可以看见报表,编译也通过,但是一浏览就出问题了。下面请看出错的地方 datagrid請教 实现BLOG WEB API 建议.. XML-RPC 还是 web services?
{
if (!Page.IsPostBack)
{
Session["session1"] = "111";
Session["session2"] = "222";
Label1.Text = Session["session1"].ToString();
Label2.Text = Session["session2"].ToString();
}
}
void Application_Start(object sender, EventArgs e)
{
Application["total"] = 0; }在default.aspx.cs中也可以应用:
protected void Page_Load(object sender, EventArgs e)
{
this.Label1.Text = Application["total"].ToString(); }记得加分呀!
Session["UserName"]=this.txtUname.Text;
读取
this.Label1.Text=Session["UserName"].ToString();