国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

web程序記錄當(dāng)前在線人數(shù)

2019-11-17 03:20:34
字體:
供稿:網(wǎng)友

web程序記錄當(dāng)前在線人數(shù)

在頁面上顯示當(dāng)前在線人數(shù)

效果:

1、Global.asax文件:

<%@ application Language="C#" %><%@ Import Namespace="System.xml" %><script runat="server"> void Application_Start(object sender, EventArgs e) { // 在應(yīng)用程序啟動時運行的代碼 //載入配置文檔 XmlDocument AppConfig = new XmlDocument(); AppConfig.Load(HttpContext.Current.Server.MapPath("~/AppConfig.xml")); //讀取配置信息 XmlNode xnList = AppConfig.GetElementsByTagName("dblist")[0]; XmlElement xeDb1 = (XmlElement)xnList.ChildNodes[0]; XmlElement xeDb2 = (XmlElement)xnList.ChildNodes[1]; Application["db1user"] = xeDb1.GetAttribute("user"); Application["db1source"] = xeDb1.GetAttribute("source"); Application["db2user"] = xeDb2.GetAttribute("user"); Application["db2source"] = xeDb2.GetAttribute("source"); Application["count"] = 0; } void Application_End(object sender, EventArgs e) { //在應(yīng)用程序關(guān)閉時運行的代碼 } void Application_Error(object sender, EventArgs e) { //在出現(xiàn)未處理的錯誤時運行的代碼 } void session_Start(object sender, EventArgs e) { //在新會話啟動時運行的代碼 Application["count"] = Convert.ToInt32(Application["count"])+1; } void Session_End(object sender, EventArgs e) { //在會話結(jié)束時運行的代碼。 // 注意: 只有在 Web.config 文件中的 sessionstate 模式設(shè)置為 // InPRoc 時,才會引發(fā) Session_End 事件。如果會話模式 //設(shè)置為 StateServer 或 SQLServer,則不會引發(fā)該事件。 Application["count"] = Convert.ToInt32(Application["count"]) - 1; } </script

-----------------------

2、顯示頁面:

前臺:

<span id="Span1" runat="server" class="bottom"> </span>

后臺:

Span1.InnerHtml = "當(dāng)前在線" + Application["count"].ToString() + "人";


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 古田县| 苏尼特右旗| 大港区| 大足县| 镇雄县| 潢川县| 南通市| 琼结县| 太康县| 沅江市| 阳春市| 甘谷县| 墨竹工卡县| 安化县| 吴桥县| 凤庆县| 四川省| 额尔古纳市| 九龙县| 广宁县| 克山县| 广南县| 南投县| 射洪县| 林西县| 紫金县| 陇川县| 娄烦县| 客服| 孟村| 永仁县| 洛扎县| 砀山县| 乌鲁木齐市| 安平县| 茶陵县| 宁强县| 普兰店市| 德安县| 界首市| 江山市|