ASP.NET - Javascript timeOut Warning based on sessionState timeOut in web.config

后端 未结 6 1615
囚心锁ツ
囚心锁ツ 2020-12-06 08:33

Problem: I am looking to create a time-out warning message on an asp.net page with a c# code behind based off my webconfig sessionState TimeOut Attribute.

Code on w

6条回答
  •  庸人自扰
    2020-12-06 09:13

    I created a time-out warning message askign the user to save data before the session times out in x number of remaining minutes using the following javascript code on my asp.net edit.aspx page:

    
    

    I set the frequency of the warning message to every 20 minutes and made it easy to change by putting it as a variable under the application settings, which is also accessible in the web.config under and defined as a key (SessionWarning) w/ a value to 20 (representing 20 minutes).

    Here's the code I used on my web.config file:

    
        
            
            
            
            
            
            
            
            
            
        
        
            
        
        
            
                
                    
                        
                        
                            
                            
                        
                    
                    
                        
                        
                            
                            
                        
                    
                
            
        
    
    

提交回复
热议问题