Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

Users are validated but not authenticated

$
0
0

Guys, I just can't understand this. Users are validated and logged in but they are not authenticated. Membership.ValidateUser() passes but when I check User.Identity.IsAuthenticated, it always returns false. What am I missing. The problem is just very strange to me. Please I need help ASAP.

Below is the code

protected void LoginButton_Click(object sender, EventArgs e)
        {
            if (Membership.ValidateUser(txtEmail.Text, txtPassword.Text))
            {
                FormsAuthentication.RedirectFromLoginPage(txtEmail.Text, false);if (HttpContext.Current.User.Identity.IsAuthenticated) { string name = Membership.GetUser().UserName; }
            }
            else
            {
                lblInfo.Text = "Invalid email or password!";
            }
        }

The lines in bold never execute even after user has been logged in by the line immediatel above.


Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>