I am trying to use forms authentication on a site. I have put the users in the web.config. The login works fine, but when I go to the default.aspx, the User.Identity.Name is empty. Shouldn't it contain the user name?
In the login page, I use the following:
If FormsAuthentication.Authenticate(txtUser.Text, txtPassword.Text) Then
'FormsAuthentication.RedirectFromLoginPage(txtUser.Text, chkPersistLogin.Checked)
FormsAuthentication.RedirectFromLoginPage(txtUser.Text, False)
Else
ErrorMessage.InnerHtml = "Something went wrong... please re-enter your credentials..."
End If
Then in default.aspx, I try to check if the user is authenticated and get the user name with this code:
If User.Identity.IsAuthenticated Then
'display Credential information
displayCredentials.InnerHtml = "Current User : " & User.Identity.Name & "" & _
"<br><br>Authentication Used : " & User.Identity.AuthenticationType & ""
On the web site, Anonymous is not checked, but Windows Integrated is. Is that the problem?