This project is read-only.

Troubleshooting an intermitenet login problem

Apr 29, 2015 at 10:07 PM
Hello,

I have implemented the default individual user account identity.net authentication for a forms based app. I am new to this so I've only implemented the bare minimum to to authenticate certain sections of my webapp. Here is the tutorial that I followed for my implementation: http://www.asp.net/identity/overview/getting-started/adding-aspnet-identity-to-an-empty-or-existing-web-forms-project

I am having an intermittent login problem with my app. This happens on both my development environment (VS 2013) and my deployed application on an IIS server. When the issue arises, I am unable to login to the app, though I am certain I am providing the correct username and password. The authentication page, does not provide any type of error. The form just resets, removing both the username and password. I can continue to try to login but the same things happens. If I wait long enough, I will be able to login. Perhaps this is after the session expires???

Here is my very basic authentication code:
protected void Page_Load(object sender, EventArgs e)
        {
            RegisterHyperLink.NavigateUrl = "Register";
            OpenAuthLogin.ReturnUrl = Request.QueryString["ReturnUrl"];
            var returnUrl = HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]);
            if (!String.IsNullOrEmpty(returnUrl))
            {
                RegisterHyperLink.NavigateUrl += "?ReturnUrl=" + returnUrl;
            }
        }

        protected void LogIn(object sender, EventArgs e)
        {
            if (IsValid)
            {
                // Validate the user password
                var manager = new UserManager();
                ApplicationUser user = manager.Find(UserName.Text, Password.Text);
                if (user != null)
                {
                    IdentityHelper.SignIn(manager, user, RememberMe.Checked);
                    IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);
                }
                else
                {
                    FailureText.Text = "Invalid username or password.";
                    ErrorMessage.Visible = true;
                }
            }
        }
The page require authentication are in a subfolder with this webconfig file:
<?xml version="1.0"?>
<configuration>


    <system.web>
      <authorization>
        <deny users="?"/>
      </authorization>
    </system.web>

</configuration>
I have looked at both my IIS standard and error logs but do not see anything indicative of an issue. Would anyone have any idea on what might cause this or tips on better troubleshooting this issue?

Thanks,

B
Jul 29, 2016 at 3:19 PM
I am having this issue as well. Anyone ever solve this?