簡體   English   中英

用戶關閉窗口時可以更改全局變量值嗎

[英]Can I change global variables value when users close window

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類中具有Global變量。 當用戶關閉窗口時,我想將該全局變量設置為1。

我認為您無法在用戶關閉窗口時設置全局變量。 您可以設置它,但是如果用戶再次打開窗口,它將自動具有舊值(初始化中的值)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM