3
我試圖將[email protected]&AFRSPASSWORD=%&v~lyHYNrTCcQq6
的值存儲到Cookies["AFRSSTATION"]
。值已成功保存,我可以使用瀏覽器查看它。訪問值時遇到問題。當我嘗試獲得returningUser["AFRSUSERNAME"]
的值時,我得到了[email protected]
,值returningUser["AFRSPASSWORD"]
是%
。它看起來像內部函數在&
符號的基礎上分割值。我的問題是我如何保存在Cookie中登錄&。由於波紋管是相關的代碼保存'&'登錄Cookie
HttpCookie returningUser = null;
if (HttpContext.Current.Request.Cookies["AFRSSTATION"] != null)
{
returningUser = HttpContext.Current.Request.Cookies["AFRSSTATION"];
if (returningUser["AFRSUSERNAME"] != null &&
returningUser["AFRSUSERNAME"] != "" &&
returningUser["AFRSPASSWORD"] != null &&
returningUser["AFRSPASSWORD"] != "")
{
UserName = returningUser["AFRSUSERNAME"];
Password = returningUser["AFRSPASSWORD"];
的可能重複://stackoverflow.com/questions/4125807/broken-string-in-cookie-after-ampersand-javascript) – David