Example: ===========logout.aspx page ============================
<title></title>
<script language= ' javascript ' type= ' Text/javascript ' >
var secs = 5; Number of seconds to Countdown
var URL;
function Load (URL) {
url = URL;
for (Var i=secs;i>=0;i--)
{
Window.settimeout (' doupdate (' + i + ') ', (secs-i) * 1000);
}
}
function doupdate (num)
{
document.getElementById (' msg '). InnerHTML = ' You have exited login, will return ' in ' + num + ' seconds;
if (num = = 0) {Window.location=url}
}
</script>
<body>
<form id= "Form1" runat= "Server" >
<div id= "msg" style= "margin:20px auto;" ></div>
<script language= ' javascript ' type= ' Text/javascript ' >
Load ("<% = Getreturnurl ()%>");
<!---the ASP.net method called here, you can also write the URL address directly here-->
</script>
</form>
</body>
===========logout.aspx.cs page ============================
protected void Page_Load (object sender, EventArgs e)
{
Session.clear ();
Session.removeall ();
System.Web.Security.FormsAuthentication.SignOut ();
}
protected String Getreturnurl ()
{
if (string. IsNullOrEmpty (request.querystring["ReturnUrl"]))
{
return "/";
}
Else
{
return request.querystring["ReturnUrl"];
}
}