0
我創建了登錄頁面並在其上放置了4個控件。 (2文本框輸入用戶名和密碼&一個按鈕提交&一個dropdownlist
) 我使用下面的代碼來記住coockie密碼,它的工作:記住密碼並在下拉列表中選擇項目
FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, true);
還我想記住我的下拉列表由用戶選擇的項目。 我該怎麼做?
我創建了登錄頁面並在其上放置了4個控件。 (2文本框輸入用戶名和密碼&一個按鈕提交&一個dropdownlist
) 我使用下面的代碼來記住coockie密碼,它的工作:記住密碼並在下拉列表中選擇項目
FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, true);
還我想記住我的下拉列表由用戶選擇的項目。 我該怎麼做?
集餅乾:
Response.Cookies["DropDown"].Value = MyDropDownList.SelectedItem.Text;
,並在頁面加載得到的cookie:
if(Request.Cookies["DropDown"]!=null)
{
var valueFromCookie = Request.Cookies["DropDown"].Value;
}
謝謝!這行得通 :) –