当前位置:首页 > 设计在线 > 网页设计 > Javascript > Ajax.Net:How to use Session and Cookie in AjaxMethod?

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

点击次数:20 次 发布日期:2008-11-26 22:40:52 作者:源代码网
源代码网推荐

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.


源代码网供稿.
网友评论 (0)
会员中心
设计在线
本站推荐
设计在线之精华