寫入Cookie:
HttpCookie custCookie = new HttpCookie("Customer");
custCookie.Values.Add("CustID", HttpUtility.UrlEncode("A12345"));
custCookie.Values.Add("CustName", HttpUtility.UrlEncode("王小明"));
讀取Cookie:
HttpCookie custCookie=Request.Cookies["Customer"];
string CustID = HttpUtility.UrlDecode(custCookie.Values["CustID"]);
string CustName = HttpUtility.UrlDecode(custCookie.Values["CustName"]);
沒有留言:
張貼留言