如何在另一个aspx中访问带有值的变量? [英] How to access to a variable with value in another aspx?

查看:59
本文介绍了如何在另一个aspx中访问带有值的变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

变量在PageA.aspx中定义(例如string s =Hi;)。 PageB.aspx有可能获得价值吗?如果有,怎么样?谢谢。

A variable is defined in PageA.aspx (e.g. string s = "Hi";). Is it possible for PageB.aspx to get the value? If yes, how? Thanks.

推荐答案

在A.aspx Session [field1] =value1;

在B.aspx字符串中field1 =(字符串)(Session [field1]);

解决
In A.aspx Session["field1"] = "value1";
In B.aspx string field1 = (string)(Session["field1"]);
Solved


请参阅我的过去的回答:在页面之间传递数据 [ ^ ]。



-SA
Please see my past answer: Passing Data Between Pages[^].

—SA


这篇关于如何在另一个aspx中访问带有值的变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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