How to check whether session is null or not in javascript?It is right way?
if ('<%=Session["Time"] == null%>')
{
alert('null session');
}
Here's a solution that will test every 500 milliseconds if the user session has expired.
function CheckSession() {
var session = '<%=Session["username"] != null%>';
if (session == false) {
alert("Your Session has expired");
window.location = "login.aspx";
}
}
setInterval(CheckSession(),500);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With