我是ASP.NET的新用戶,因此請耐心等待:D 我想將其中一個頁面重定向到另一個頁面,並保留用戶名! 我試圖使用session.add和會話[],但是當我想插入括號內的用戶名,它說使用必須int!但我想我應該使用會話[「用戶名」] 我用另一種方式(的Request.QueryString []),但兩者都有問題 這裏是我的代碼使用會話重定向頁面
//first solution
string username="asal";
session.Add(username,username);
Response.Redirect("~/Doctor/DoctorsMainPage.aspx");
//in the other page
Label1.Text= Session["username"].ToString();//this one says use int?!
//i used this one instead of it
Label1.Text= Session[0].ToString();//with this one i get the username in other page,but one i want to pass another string like "id" with session,I can not!
//the second solution
string username="asal";
Response.Redirect("~/Doctor/DoctorsMainPage.aspx?username");
Label1.Text = Request.QueryString["username"];//this one redirect to doctors main page but set the value of username to "" !
哦TNX了很多! :) – asal 2011-06-11 10:24:09