url里面需要一个用户名,进入用户空间。
<a href='User/Space.aspx?name=Session["UserName"]'>
这样显然是不行的。用DataList吧,又没办法绑定数据。select出来也没用啊,怎样解决?index.aspx        <div id="islogin" runat="server">
        <a href='User/Space.aspx?name=<%# Eval("UserName") %>'>
         <asp:Label ID="user" runat="server" Text="Label"></asp:Label>
         </a>您已经登录了
        </div>index.aspx.cs                string user_sql = "select * from User where UserName=" + Session["UserName"] + "";
                SqlCommand cmd1 = new SqlCommand(user_sql, cn);
                SqlDataReader dr1 = cmd1.ExecuteReader();                DataTable table = new DataTable();
                table.Columns.Add("UserName", typeof(string));                while (dr1.Read())
                {
                    DataRow row = table.NewRow();
                    row["UserName"] = dr1["UserName"].ToString();
                }
                //GridView1.DataSource = table;
                //GridView1.DataBind();
                //dr1.Close();
                //cn.Close();