Search code examples
asp.netasp.net-membershipidentitymembership-providermembership

How to force log off for User.Identity.Name


My application is retrieving the wrong identity. It's taking my OS name rather than my web application user name. I've tried to set a new identity with the following code, but it still grabs my OS account name.

If User.Identity.Name = "DOMAIN\Name" Then
        FormsAuthentication.SignOut()
        HttpContext.Current.User = New GenericPrincipal(New GenericIdentity(String.Empty), Nothing)
    End If

I would like to forcefully log off from User.Identity.Name because every time I boot, the name is wrong. Can I build my web application with the default name as null, until I login through the application?

I've tried to reboot my desktop, but the name still is taken from my OS identity. How can I make it stop!!!

Note: the way the user name was set, was I got a pop up that prompted me my user name and password for the OS account, but the website shouldn't do that. It was OS verification. Now I need that to be detached.

<authentication mode="Forms">
  <forms loginUrl="login.aspx" defaultUrl="Welcome.aspx" cookieless="UseCookies" slidingExpiration="true" timeout="20" name=".Auth" protection="All">
  </forms>
</authentication>

Solution

  • Do you have Windows Authentication disabled in IIS?

    Windows Authentication Disabled