Ajax.Net:How to use Session and Cookie in AjaxMethod?

来源: 作者: 2007-11-23 出处:pcdog.com

.net  access  ajax  

  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.
更多内容请看PCdog.com--Ajax技术专题
上一篇:AJaX for weblogs
下一篇:Ajax: Web应用开发的一种新方法