application限制人数的问题
void Application_Start(object sender, EventArgs e)
{
int UserAmount = 0;
UserAmount = Convert.ToInt32(Application["UserKey"]) + 1;
if (UserAmount >= 10)
{
//...进入程序
}
else
{
//...跳转错误页面
}
}
void Application_End(object sender, EventArgs e)
{
Application["UserKey"] = Convert.ToInt32(Application["UserKey"]) - 1;
}
限制程序只能有10人 超出人数就弹出错误页面
但是我上面好像无效 是不是哪里有问题