Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi
In my project i am using windows application..

but here how to use session time out in windows application??????


please give any suggestion........
Posted
Comments
ThatsAlok 12-Dec-12 2:28am    
session timeout in Window Application? its not available by default, you have to implement it dear
sri apple 12-Dec-12 4:32am    
I know session timeout is not available.. but i am asking same concept how to do in windows application...
Kiran Susarla 12-Dec-12 2:28am    
There is no concept of session time out in windows application. Can you please what is your requirement and why you want to go for session?
sri apple 12-Dec-12 4:35am    
if user log-in into page after he can't do any thing then automatically log-out from the page...
Sergey Alexandrovich Kryukov 12-Dec-12 2:34am    
What session, for goodness sake? :-)
--SA

1 solution

Your simplest solution would be to use a Timer and set the Duration property to the number of milliseconds you'd like in your timeout. Whenever you encounter activity, you can just reset the timer by calling Stop then immediately calling Start. Place whatever code you'd like in the Timer's Tick event (assuming this is a System.Windows.Forms.Timer) and you'll be all set.

(Source : Stack Overflow)
 
Share this answer
 
Comments
sri apple 12-Dec-12 5:06am    
Here i am using Timer's Tick event...
but Tick event loop is continue for two times.
[no name] 12-Dec-12 5:24am    
provide your code please...
sri apple 12-Dec-12 5:57am    
Timer timer = new Timer();
public Form2()
{
InitializeComponent();

timer1.Tick += new EventHandler(timer1_Tick); // Everytime timer ticks, timer_Tick will be called
timer1.Interval = (1500) * (10); // Timer will tick evert 10 seconds
timer1.Enabled = true; // Enable the timer
timer1.Start(); // Start the timer

}

private void timer1_Tick(object sender, EventArgs e)
{

timer1.Stop();


timer1.Enabled = false;


Form1 f = new Form1();
f.Show();
this.Hide();




}
[no name] 12-Dec-12 6:01am    
Stop timer under some other control i.e Button_Click event..
sri apple 12-Dec-12 6:31am    
here my problem is display Form1 is two times...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900