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.

本文作者:
« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3