【发布时间】:2012-12-06 13:31:06
【问题描述】:
我正在使用 John Culviner 的 jquery.filedownload 插件。
为此,我需要编写一个 cookie。如何从静态网络方法中编写 cookie?作为页面。响应是一个实例字段,我无法从静态方法访问它。
【问题讨论】:
标签: c# asp.net cookies static-methods
我正在使用 John Culviner 的 jquery.filedownload 插件。
为此,我需要编写一个 cookie。如何从静态网络方法中编写 cookie?作为页面。响应是一个实例字段,我无法从静态方法访问它。
【问题讨论】:
标签: c# asp.net cookies static-methods
在您的WebMethod 中使用HttpContext.Current 属性。
【讨论】:
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");
【讨论】: