ajax.net调用session和cookie

it2022-05-09  34

Ajax.Net在后台调用Session和Cookie比较特殊,需要使用如下的写法:

 

Cookie:HttpContext.Current.Response.Cookie[key]Session:HttpContext.Current.Session[key]

 

此外,要使用Session还需要在AjaxMethod特性后加Ajax.HttpSessionStateRequirement参数:

 

 

[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.Read)] public string GetInfo( string a){ // do something }

 

HttpSessionStateRequirement枚举有:None,Read,ReadWrite,根据你的需要选用即可。

转载于:https://www.cnblogs.com/tuyile006/archive/2010/10/17/1853664.html

相关资源:数据结构—成绩单生成器

最新回复(0)