Javascript Alert before redirecting in ASP.NET

You can not do that, the way you try because the message is running on the client side, but you make the redirect on code behind before the page loading to show the message.

The way to do that is to call right after the message a client side redirect as:

window.location = "NextPage.asps";

Display the alert with javascript and then do the redirect with the same:

ScriptManager.RegisterStartupScript(this,this.GetType(),"redirect",
"alert('Time OutAlert'); window.location='" + 
Request.ApplicationPath + "Nextpage.aspx';",true);