Bhu*_*kla 3 asp.net ajax session c#-4.0
我有以下 webmethod,我想修改现有 Session 变量的值,但在 webmethod 内部,每当我将值分配给该会话变量时,该值都不会分配给它。
网络方法
[WebMethod(EnableSession = true)]
public static List<tblCustomerList> CustData(String id)
{
Int32 count=(Int32) HttpContext.Current.Session["pgnum"];
HttpContext.Current.Session["pgnum"] = count++;
DataGridEntities _dbContext = new DataGridEntities();
var filteredResult = _dbContext.tblCustomerLists.ToList();
return filteredResult;
}
Run Code Online (Sandbox Code Playgroud)
在您的代码中,您应该这样做,因为 count++ 将分配现有值,然后增加其值
HttpContext.Current.Session["pgnum"] = ++count;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1799 次 |
| 最近记录: |