这种方法是在代码隐藏类中声明属性和变量,然后在新网页中用Context.Handler对象获取这些属性或变量的值。
下面举个简单的例子。
源页面中包含以下代码:
public string P1
{get{return TextBox1.Text;}}
public string P2
{get{return TextBox2.Text;}}
然后调用Server.Transfer方法
Server.Transfer("object.aspx");
目标页面包含以下代码:
SourceForm1 f1;
f1=(SourceForm1)Context.Handler;
Label1.Text=f1.P1;
Label2.Text=f1.P2;
{get{return TextBox1.Text;}}
public string P2
{get{return TextBox2.Text;}}
然后调用Server.Transfer方法
Server.Transfer("object.aspx");
目标页面包含以下代码:
SourceForm1 f1;
f1=(SourceForm1)Context.Handler;
Label1.Text=f1.P1;
Label2.Text=f1.P2;

