在WebForm1.aspx 的某个事件中写入如下代码:Server.Transfer("WebForm2.aspx"); //传递页面对象
接着就可以在WebForm2.aspx.cs中获取WebForm1的页面对象。
if(Context.Handler is WebForm1) //判断传递过来的是否WebForm1,因为可能会有多个传递对象。
{
WebForm1 f1=(WebForm1)Context.Handler; //通过Context.Handler来创建一个WebForm1的页面对象,返 回一个object
Response.Write("Hey,I get it with Context Handler "+((TextBox)f1.FindControl("TextBox1")).Text+"