如何传递两个或更多的aspx页面之间的会话变量? [英] How pass session variables between two or more aspx pages?

查看:86
本文介绍了如何传递两个或更多的aspx页面之间的会话变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的情景,

即时通讯使用asp.net 2.0。我有网站在那里创建一个唯一的ID,并插入数据库,并在文本框是不可见的显示。现在我需要这个ID发送到下一个页面。我用会议(MEMBERID)= Txtnewid.Text。它不工作这表明零值时,我分配给变量字符串。请帮帮我 。在此先感谢

Im using asp.net 2.0 .I have Site where it creates a unique id and it is inserted in Database and displaying in Textbox that is invisible. Now i need to send this Id to next Page. i Used Session("MemberId") = Txtnewid.Text. Its not working It shows zero value when i assign to variable string. Please Help Me . Thanks in advance

推荐答案

您不需要的值存储在一个文本框,在所有。所有你需要做的就是把ID,并在第一次创建会话插入;在同一个页面或网站中的其他任何后续请求,您可以通过访问这个ID:

You don't need to store the value in a textbox at all. All you need to do is take the id and insert it in session the first time is created; on subsequent requests on the same page or any other within your site, you can access this id by doing:

string id = Session["MemberId"] as string;

或者在VB语法:

Or in Vb syntax:

dim id as String = Session("MemberId")

这篇关于如何传递两个或更多的aspx页面之间的会话变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆