我正在使用John Culviner的jquery.filedownload插件。如何在静态webmethod中写入cookie
为了这个工作,我需要写一个cookie。如何从静态webmethod中写入cookie?作为页面。响应是一个实例字段,我无法从静态方法访问它。
我正在使用John Culviner的jquery.filedownload插件。如何在静态webmethod中写入cookie
为了这个工作,我需要写一个cookie。如何从静态webmethod中写入cookie?作为页面。响应是一个实例字段,我无法从静态方法访问它。
使用HttpContext.Current
属性在您的WebMethod
。
var myCookie = new HttpCookie("CookieName");
myCookie["key"] = "val";
HttpContext.Current.Response.Cookies.Add(myCookie);
HttpContext.Current.Response.Cookies.Get("CookieName");
使用FF:代码:
HttpCookie objHTTPCk = HttpContext.Current.Request.Cookies.Get("Cookie name");