第一个页面:
    protected void Button1_Click(object sender, EventArgs e)
    {        Session("name") = TextBox1.Text;
        Response.Redirect("Default2.aspx");
    }
}第二个页面
    protected void Page_Load(object sender, EventArgs e)
    {        Label1.Text = DateTime.Now.ToString();
        Label2.Text = Session("name");
    }
怎么提示:
Error 1 'System.Web.UI.Page.Session' is a 'property' but is used like a 'method' D:\study of C#\WebSite13\Default2.aspx.cs 21 23 D:\study of C#\WebSite13\
望指教

解决方案 »

  1.   

    Sssion是object
    text是String 转化下看下
      

  2.   

    Session("name") = TextBox1.Text;
    这个也是绰的
      

  3.   

    Session是集合用[]
    Session["name"] = TextBox1.Text;
      

  4.   

    改成这样
    ==========第一个页面:
        protected void Button1_Click(object sender, EventArgs e)
        {        Session["name"] = TextBox1.Text;
            Response.Redirect("Default2.aspx");
        }
    }第二个页面
        protected void Page_Load(object sender, EventArgs e)
        {        Label1.Text = DateTime.Now.ToString();
            Label2.Text = Session["name"].ToString();
        }