版权声明:转载原创文章请以超链接形式请注明原文章出处,尊重作者,尊重原创!
恰饭广告
新建一个全局应用程序类Global.asax和一个Web窗体Default.aspx
Global.asax.cs代码:
protected void Application_Start(object sender, EventArgs e) { Application["count"]= 0; } protected void Session_Start(object sender, EventArgs e) { Application.Lock(); Application["count"] = (int) Application["count"] + 1; Application.UnLock(); } protected void Session_End(object sender, EventArgs e) { Application.Lock(); Application["count"] = (int)Application["count"] - 1; Application.UnLock(); }
Default.aspx.cs代码:
protected void Page_Load(object sender, EventArgs e) { Label1.Text ="访问量"+ Application["count"].ToString(); }
原文链接:https://www.idaobin.com/archives/1184.html
让我恰个饭吧.ヘ( ̄ω ̄ヘ)
恰饭广告