How to prevent Session.Timeout
extension on certain event from codebehind?
<asp:Timer ID="Timer7" runat="server" Interval="540000" ontick="Timer7_Tick">
</asp:Timer>
protected void Timer7_Tick(object sender, EventArgs e)
{
showModalPopupServerOperatorButton_Click(null, null);
Timer7.Enabled = false;
}
Initial calculations was that 1 minute before the session ends, i'll inform the user something with the ModalPopup
. The problem is that when this Timer7_Tick
event triggers, the Session.Timeout
renew and the session ends 10 minutes later (if user still don't send any request from his browser).
Server side execution will extend session timeout. If you just want to popup a dialog, try using JavaScript
without any postbacks.
15+ jQuery Popup Modal Dialog Plugins and Tutorials.
An alternative of using Timer control
, use this JavaScript:
<script type="text/javascript">
setTimeout(function () {
alert("Event");
}, 540000);
</script>