RegisterStartupScript on Logout page
<p>I am trying to have a logout page where is displays a messages and then redirects to the login page. This is in ASP.net 2.0</p>

<p>I have this in my Page_Load</p>

<p>ClientScript.RegisterStartupScript(typeof(Page), "pageredirect", JavascriptRedirect());</p>

<p>This is my redirect function:</p>

<pre><code>private string JavascriptRedirect()
{
    StringBuilder sb = new StringBuilder();
    sb.Append("&lt;script type=\"text/javascript\" language=\"javascript\"&gt;");
    sb.Append("var x = 5;");
    sb.Append("var y = 1;");
    sb.Append("function startClock(){");
    sb.Append("x = x-y;");
    sb.Append("t=setTimeout(\"startClock()\", 1000);");
    sb.Append("if(x==0){");
    sb.Append("window.location='login.aspx';");
    sb.Append("clearTimeout(t);");
    sb.Append(" }");
    sb.Append(" }");
    sb.Append("startClock();");
    sb.Append("&lt;/script&gt;");
    return sb.ToString();
}
</code></pre>

<p>When I test there is no javascript in my resulting logout page. Anyone have an idea on what is happening. Is Page_Load to late to register this?</p>
