ASP.NET?????·?ApplicationС????
???????????? ???????[ 2015/6/5 13:49:29 ] ???????????????
????????
???????????ASP.NET????????????ASP.NET?????????????????????????ж???ο????????????????????????????????£???л???
????Session????
????Application??????????????????????????????????????????????
?????????Application???????????lock unlock??????????????3???????
????Application?????????????????????IIS?????Clear?????????
????Application???
???????????Application????????????????
???????????????????????Globle.asax????????????????д?????
void Application_Start(object sender?? EventArgs e)
{
// ????ó??????????е????
Application["CusCount"] = 0;
}
void Session_Start(object sender?? EventArgs e)
{
// ????????????е????
Application.Lock();
Application["CusCount"] =(int) Application["CusCount"] + 1;
Application.UnLock();
}
void Session_End(object sender?? EventArgs e)
{
// ???????????е????
// ???: ????? Web.config ????е? sessionstate ???????
// InProc ?????????? Session_End ????????????????? StateServer
// ?? SQLServer???????????????
Application.Lock();
Application["CusCount"] = (int)Application["CusCount"] - 1;
Application.UnLock();
}
????????д??????web???壬д????
????protected void Page_Load(object sender?? EventArgs e)
????{
????Response.Write("???????" + Application["CusCount"] + "λ???<br/>");
????}
???????????Application???????????????
??????????????棬д????
????protected void Page_Load(object sender?? EventArgs e)
????{
????Response.Write("???????" + Application["CusCount"] + "λ???<br/>");
????Application.Add("Key1"?? "Value1");
????Application.Add("Key1"?? "Value1");
????Application.Add("Key1"?? "Value1");
????for (int index = 0; index < Application.Count; index++)
????{
????Response.Write(Application.GetKey(index) + ": ");
????Response.Write(Application.Get(index) + "<br/>");
????}
????}
?????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11