111,129
社区成员
发帖
与我相关
我的任务
分享
protected void Application_Start(Object sender, EventArgs e)
{
try
{
long lCount = 0;
StreamReader sdr = new StreamReader(Server.MapPath("App_Data/count.txt"));
string strCount = sdr.ReadLine();
if (strCount != null)
{
if (strCount.Trim().Replace(((char)13).ToString(), "") != "")
{
lCount = long.Parse(strCount);
}
}
sdr.Close();
Application.Lock();
Application["counter"] = lCount;
Application.UnLock();
}
catch { }
}
protected void Session_Start(Object sender, EventArgs e)
{
try
{
if (Request.ServerVariables["URL"].IndexOf("admin") == -1)
{
long lCount = 0;
lCount = long.Parse(Application["counter"].ToString()) + 1;
StreamWriter sw = new StreamWriter(Server.MapPath("App_Data/count.txt"));
sw.Write(lCount.ToString());
sw.Close();
Application.Lock();
Application["counter"] = lCount;
Application.UnLock();
}
}
catch { }
}