I have this hidden button that is linked to a function I would like to trigger automatically on the web page once the session has been timed out:
Button code:
<asp:Button runat="server" id ="btnHdn" Style="display: none" OnClick="Button1_Click"/>
Timeout session trigger:
setTimeout(function ()
{
document.getElementById("btnHdn").click;
}, timeout);
The code behind I would like to call (.cs):
protected void Button1_Click(object sender, EventArgs e)
{
RedirectToHomePage();
}
protected void RedirectToHomePage()
{
try
{
string whichCountry = ConfigurationManager.AppSettings["country"].ToString();
string isFromGMAL = ConfigurationManager.AppSettings["GMAL"].ToString();
string urlStr = "LanguageSelection.aspx";
if (whichCountry.ToLower() == "sg")
{
urlStr = "LandingPage.aspx";
}
else if (whichCountry.ToLower() == "nl")
{
urlStr = "LandingPagexxxx.aspx";
}
}
catch (System.Exception ex)
{
}
}
Apparently, the code does not seem to be working. Once the session has reached zero, nothing happened and the timer will keep continue on counting.
Would you guys please identify what is wrong with the code?