How to do session time out in Silverlight. I have Main.aspx page for enter email id for authentication.if email id is proper then it will take us to silverlight aspx page.I want to set session timeout for each session id.If the user is idle for some time it has to redirect to Main.aspx page. Please help me out.
Answer: 1
This might help you:
Answer: 2
Hi,
You can just use a simple timer on the client-side. Start the timer when user don't move the mouse or pressing a key, and stop the timer when the user moves the mouse or pressing keys. If the user haven't moved the mouse or pressed a key after 30 min, you just redirect the page to Main.aspx.
Answer: 3
Hi,
I am very fresh to this part can you provide me code or sample project if u have......it helps me lot
Answer: 4
int i;
public MainPage()
{
InitializeComponent();
System.Windows.Threading.DispatcherTimer dt =new System.Windows.Threading.DispatcherTimer();
dt.Interval = new TimeSpan(0, 0, 0, 1);
dt.Tick += new EventHandler(dt_Tick);
dt.Start();
this.KeyDown+=new KeyEventHandler(MainPage_KeyDown);
this.MouseMove+=new MouseEventHandler(MainPage_MouseMove);
}
void dt_Tick(object sender, EventArgs e)
{
i+=1;
if(i==300) // for five mins
HtmlPage.Window.Navigate(new Uri("http://localhost/YourProjectName/Main.aspx" , UriKind.RelativeOrAbsolute));
}
private void MainPage_KeyDown(object sender, KeyEventArgs e)
{
i = 0;
}
private void MainPage_MouseMove(object sender, MouseEventArgs e)
{
i = 0;
}
Answer: 5
Hi,
I have a small suggestion for you to implement session.
In silverlight you can use DispatcherTimer, whenever user stop using the site/application for more than stipulated time, then navigate/redirect him to Main.aspx.
Answer: 6
Hi,
Thank you very much it worked for me.
Answer: 7
Please do not forget to mark the replies as answers if they helped you.
Answer: 8
Hi pitchai.be,
Good Answer.
Thanks.
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog