方法 private string getGUID() { System.Guid guid = new Guid(); guid = Guid.NewGuid(); string str = guid.ToString(); return str; } 存储 string getguid = getGUID(); HttpCookie guid = new HttpCookie("guidNumck", getguid); Response.Cookies.Add(guid); Session["guidNum"] = getguid; 比较 HttpCookie guidCookies = Request.Cookies["guidNumck"]; if (guidCookies != null) { string guid = Session["guidNum"] as string; if (guidCookies.Value.ToString() != guid) { } }