ASP.NET Session and Application Online User Applications

xiaoxiao2021-03-06  45

Global.asxausing system; using system.collections; using system.bomponentmodel; using system.web.sessionState;

Namespace Elcare {///

/// global /// public class global: system.web.httpApplication {/// ///

Private system.componentmodel.icontainer component = NULL;

public Global () {InitializeComponent ();} protected void Application_Start (Object sender, EventArgs e) {Application [ "OL_UserCount"] = 0;} protected void Session_Start (Object sender, EventArgs e) {Application.Lock (); Application [ "OL_USERCOUNT"] = (int) Application ["ip_usercount"] 1; // Online User Application.Add (session.SessionId.toT7TRING (), 1); // Use sessionID as Application.Unlock (); }

Protected Void Application_BeginRequest (Object Sender, Eventargs E) {}

Protected void Application_endRequest (Object Sender, Eventargs E) {

}

Protected void Application_AuthenticateRequest (Object Sender, Eventargs E) {}

Protected void application_error (Object sender, Eventargs E) {

}

protected void Session_End (Object sender, EventArgs e) {Application.Lock (); Application.Remove (Session.SessionID.ToString ()); Application [ "OL_UserCount"] = (int) Application [ "OL_UserCount"] - 1; Application .Unlock ();

Protected Void Application_end (Object Sender, Eventargs E) {

} #Region ///

/// private void InitializeComponent () {this.components = new System.ComponentModel.Container ();} #endregion}} login authentication aspx public void IdPassInSQL () {string strConn = (String) ((NameValueCollection) Context.GetConfig ( "system.web / database")) [ "strConn"]; using (SqlConnection conn = new SqlConnection (strConn)) {SqlCommand cmd = new SqlCommand ( "sp_IDPWD", CMD.COMMANDTYPE = CommandType.StoredProcedure; cmd.parameters.add ("@ id", sqldbtype.varchar, 20); cmd.parameters.add ("@ pwd", sqldbtype.varchar, 20); cmd.parameters ["@ID"]. Value = txtname.text; cmd.parameters ["@ PWD"]. Value = txtpwd.text; conn.open ();

转载请注明原文地址:https://www.9cbs.com/read-59059.html

New Post(0)