Forms Authentication too many redirects issue
<p>I have a website that uses form authentication. For some reason it works fine at the first run. But on the second run it says too many redirects error.</p>

<p>Loginpage:Load event</p>

<pre><code> protected void Page_Load(object sender, EventArgs e)
            {
                if (Request.IsAuthenticated)
                {
                    Response.Redirect("HomePage.aspx");
                }

            }
</code></pre>

<p>Login Page submit credentials</p>

<pre><code> protected void btnSubmit_Click(object sender, EventArgs e)
        {
           int recordExistCount = fc.Authenticate(txtUsername.Text.Trim(), txtPassword.Text.Trim());
           if (recordExistCount == 1)
           {
               Session["User"] = "Authenticated";
               Session["Username"] = txtUsername.Text.Trim();
               fc.IsOnlineRecord(Session["Username"].ToString(),true);
               FormsAuthentication.RedirectFromLoginPage(Session["Username"].ToString(), true);
               Response.Redirect("HomePage.aspx");
           }
           else
           {
               lblStatus.Text = "Username or password specified are incorrect";
               lblStatus.BackColor = Color.Yellow;               
           }
        }
</code></pre>

<p>Masterpage signout button</p>

<pre><code>protected void lbSignOut_Click(object sender, EventArgs e)
        {
            Session.Abandon();
            FormsAuthentication.SignOut();
            Response.Redirect("LoginPage.aspx");
        }
</code></pre>
