HttpSessionStateRequirement.ReadWrite 和HttpSessionStateRequirement.Read 属性
[AjaxMethod(HttpSessionStateRequirem
ent.ReadWrite)] // 读写Session:
或
[AjaxMethod(HttpSessionStateRequirement.Read)] // 只读Session:
或
[AjaxMethod(HttpSessionStateRequirem
【服务器端】
[AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)]
public string getTest()
{
Hashtable hash
=
(Hashtable)HttpContext.Current.Session[
"UserName
"
];
} Session以及Application 、Request等,都是由Page类继承下来的(你可以this.Session点出来),而用Ajax.net对后台方法访问的时候,这些方法并不属于Page类,所以才需要从HttpContext.Current中读取。而Session又更特别些,需要加[AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)]才能被访问。