Originally posted by Atul Savant:
If you want to display it exactly 2 minutes before the session expires. I am not sure about how you should go about it.
Yes, that's the impossible part. Your server only responds to requests, so if the client never sends you any more requests then you can't do this notification. And if you think about it for a bit, the client may not even have a page of your web application displayed. They might be checking their e-mail, or they might have turned off their computer.
The usual way to keep track of the client's time before session expiry is via Javascript on the client. But that's a subject for a different forum.