Ajax.Net:How to use Session and Cookie in AjaxMethod?-.Net技术-3P代码网
繁体中文
设为首页
加入收藏
当前位置:.Net技术首页 >> Asp.Net开发 >> Ajax.Net:How to use Session and Cookie in AjaxMethod?

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

2007-09-15 08:00:00  作者:  来源:互联网  浏览次数:0  文字大小:【】【】【
简介:Resolution: Add a argument of AjaxPro.HttpSessionStateRequirement enum in your AjaxPro.AjaxMethodAttribute. Here is a example: [AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.Read)] Now u ...

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.

责任编辑:admin
相关文章