这应该是非常直接的.首先将计数器设置为零,然后在后续回发中更新它:
if (!this.IsPostBack) { Session["RetryCount"] = 1; }
else
{
int retryCount = (int)Session["RetryCount"];
if (retryCount == 3) { // do something because it's bad }
else { retryCount++; Session["RetryCount"] = retryCount; }
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3308 次 |
| 最近记录: |