当用户关闭窗口时,我可以更改全局变量值吗?


public class Global : System.Web.HttpApplication
    {
        public static int timeStamp = 0;
        protected void Application_Start(object sender, EventArgs e)        
        {
        }
        protected void Session_Start(object sender, EventArgs e)
        {
        }
        protected void Application_BeginRequest(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)
        {
        }
        protected void Application_End(object sender, EventArgs e)
        {
        }
    }

我的ASP.NET(C#(页面在Global.asax类中具有全局变量。当用户关闭窗口时,我想将该全局变量设置为1。

我认为当用户关闭窗口时,您无法设置全局变量。您可以设置它,但是如果用户再次打开窗口,则它会自动具有旧值(初始化中的值(

最新更新