forms authentication and User.Identity.Name

Last post 02-24-2005 7:50 AM by lofquest. 1 replies.

Sort Posts:

  • forms authentication and User.Identity.Name

    02-22-2005, 10:57 PM
    • Member
      5 point Member
    • microspec
    • Member since 06-19-2002, 11:45 AM
    • Posts 1
    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?

  • Re: forms authentication and User.Identity.Name

    02-24-2005, 7:15 AM
    • Participant
      1,090 point Participant
    • lofquest
    • Member since 06-20-2003, 7:04 AM
    • Posts 218
    Did you set a parameter to retrieve the name? Are using a stored procedure and a class file for that? provide please more details

    I could not figure out about:I am trying to use forms authentication..On the web site, Anonymous is not checked, but Windows Integrated is.
Page 1 of 1 (2 items)