Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 16-05-2009
Member
 
Join Date: Jan 2009
Posts: 124
JavaScript to Show time countdown display after .net session timeout

I would like to know that, is it possible for me to have a javascript which will display the time countdown minutes automatically after the net session timeout gets over. Can any body tell me that how can i do it? Does any body have any idea about the above issue? Kindly provide me the correct logical solution for the above issue.
Reply With Quote
  #2  
Old 16-05-2009
Member
 
Join Date: May 2008
Posts: 2,293
Re: JavaScript to Show time countdown display after .net session timeout

Just follow teh below steps mention.

Quote:
<script type="text/javascript">
var sessionTimeout = "<%= Session.Timeout %>";
function DisplaySessionTimeout()
{
//assigning minutes left to session timeout to Label
document.getElementById("<%= lblSessionTime.ClientID %>").innerText =
sessionTimeout;
sessionTimeout = sessionTimeout - 1;

//if session is not less than 0
if (sessionTimeout >= 0)
//call the function again after 1 minute delay
window.setTimeout("DisplaySessionTimeout()", 60000);
else
{
//show message box
alert("Your current Session is over.");
}
}
</script>
Hope so it may help you out.
Reply With Quote
  #3  
Old 16-05-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
Re: JavaScript to Show time countdown display after .net session timeout

The best advice would probably be to ask the users to close the browser window once they're done. With the use of session-cookies, the session will automatically end when the browser is closed or otherwise on a 30 minute timeout. Since there by default is no interaction between the browser and the server once a page is loaded, you would have to have a javascript contact the server in the background on forms-pages to refresh the session.
Reply With Quote
  #4  
Old 16-05-2009
Member
 
Join Date: Feb 2008
Posts: 1,848
Re: JavaScript to Show time countdown display after .net session timeout

Begin by creating a new ASP.NET Server Control project called SessionTimeoutTool. This will generate both a project and a solution for you. Add a second ASP.NET Web project to the solution called TestTimeoutTool. Open the web.config file for TestTimeoutTool and add a sessionState element in order to set the session timeout period. For the purposes of testing this control, it is advisable to set this attribute to something small.

Quote:
<system.web>
<sessionState timeout="2" mode="InProc"/>
</system.web>
This establishes the control development environment.

Rename the default class in the SessionTimeoutTool project by right clicking on the default class in the Solution Explorer and renaming the file from ServerControl1.cs to TimeoutWatcherControl. The IDE will take care of renaming your class for you. The TimeoutWatchControl class comes with the Text property and the RenderContents already implemented for you by the IDE. You may delete these. You may also safely remove the ToolboxData and DefaultProperty attributes that decorate your class declaration.

Quote:
namespace SessionTimeoutTool
{
public class TimeoutWatcherControl : WebControl
{
}
}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "JavaScript to Show time countdown display after .net session timeout"
Thread Thread Starter Forum Replies Last Post
Need FPS display and timer countdown gadget for my windows 7 system Baanbhatt Customize Desktop 3 02-07-2012 04:08 PM
Countdown, redirects and text loader in Javascript Xiomar Tips & Tweaks 1 24-11-2010 06:17 AM
How to do Slide Show using JavaScript? Samarth Software Development 5 03-02-2010 07:03 AM
How can I use javascript to track session ID & Visitor ID cookies? Kushan Software Development 2 20-06-2009 12:16 PM
To show the session timeout in ASP.NET Vaibhav S Software Development 2 03-02-2009 11:35 PM


All times are GMT +5.5. The time now is 01:06 PM.