System.Web.HttpContext.Current.Response.Cookies["ssocookies"].Domain = System.Web.HttpContext.Current.Request.ServerVariables["SERVER_NAME"].ToString().ToLower();
System.Web.HttpContext.Current.Response.Cookies["ssocookies"].Value = tokenID.ToString();
System.Web.HttpContext.Current.Response.Cookies["ssocookies"].Path = "~/";
System.Web.HttpContext.Current.Response.Cookies["ssocookies"].Expires = DateTime.Now.AddDays(7);
現在當我的web應用程序中,當用戶單擊註銷以使該cookie被銷燬時,我會做什麼代碼?下面是一些使cookie成爲可能的代碼,你能告訴我如何取消它嗎?
注意我想這已經與和沒有註釋行,這是行不通的:
//System.Web.HttpContext.Current.Response.Cookies["ssocookies"].Domain = System.Web.HttpContext.Current.Request.ServerVariables["SERVER_NAME"].ToString().ToLower();
//System.Web.HttpContext.Current.Response.Cookies["ssocookies"].Value = tokenID.ToString();
//System.Web.HttpContext.Current.Response.Cookies["ssocookies"].Path = "~/";
System.Web.HttpContext.Current.Response.Cookies["ssocookies"].Expires = DateTime.Now.AddDays(-1);
System.Web.HttpContext.Current.Response.Cookies [「ssocookies」]。Value =「O hai!我給你貼了一個cookie但是我吃了它」 – hobbs 2009-11-09 20:44:57
事實證明,最初的代碼甚至沒有正確地創建一個餅乾...... – BigOmega 2010-05-04 18:34:22