您的位置:成都3c购物 >> 资讯中心 >> Ajax.Net:How to use Session and Cookie in AjaxMethod?-ajax技术教程
Ajax.Net:How to use Session and Cookie in AjaxMethod?-ajax技术教程
转载自:互联网 作者:cd3c.com
您正在看的ajax技术教程是:Ajax.Net:How to use Session and Cookie in AjaxMethod?。
Resolution:
Add a argument of AjaxPro.HttpSessionStateRequirement enum in your AjaxPro.AjaxMethodAttribute.
Here is a example:
[AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.Read)]
Now u can access ur Session value like this: this.Session["0"].ToString().
So easy,right?
Another question: How to use Cookie in AjaxMethod?
The answer is u can't access cookie by the ref of "this".
You should use HttpContext.Current Object.Like this: HttpContext.Current.Request.Cookies[Name].Value.
For more information about SessionStat in Ajax.Net,See AjaxGuide.doc.
