Hi,

I would like to know what does this mean?
I have this script loaded in page_load from my master page

Page.ClientScript.RegisterStartupScript(Me.[GetType](), "onLoad", "DisplaySessionTimeout()", True)

and a javascript data in my mastepage.aspx

            var sessionTimeout = "<%= Session.Timeout %>";
            function DisplaySessionTimeout() {
                //assigning minutes left to session timeout to Label
                document.getElementById("<%= lblSessionTime.ClientID %>").innerText = sessionTimeout;
                sessionTimeout = sessionTimeout - 1;

                //if session is not less than 0
                if (sessionTimeout >= 0)
                //call the function again after 1 minute delay
                    window.setTimeout("DisplaySessionTimeout()", 10000);
                else 
                {
                    //show message box
                    alert("Your current Session is over.");
                    window.location.href("Login.aspx");
                }
            }

In first page, this works properly.. but in when I redirect to another page, it doesn't work. Please help. Thank you in advance.

Recommended Answers

All 2 Replies

For this problem, I just inserted (;) after DisplaySessionTimeout

Page.ClientScript.RegisterStartupScript(Me.[GetType](), "onLoad", "DisplaySessionTimeout();", True)

but I got an error when it re-directs to another page.

folder/Login.aspx appears.. it should be Login.aspx only..

What error are you encountering?

Is login.aspx located on the root folder? Try...

 window.location.href("/Login.aspx")
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.