Last post Apr 10, 2014 08:34 AM by Ericzh
Apr 06, 2014 10:30 PM|AndyW2009|LINK
I have a web application (asp.net 4 Forms application) - the site is configured with both Windows and Forms authentication enabled, and anonymous access disabled. If the user is logged into a windows desktop I need to know the user account they have logged
in with, otherwise I just need to know the IP address. The user regardless of source needs to login to the application via forms authentication.
The issue that I have is that if the Identity of the user is authenticated (which is true if the user has logged into windows), then the Login view displays the authenticated template rather than the anonymous template because page.name is set (taken from
HttpContent.current.user). This results in the users windows identity being displayed so they think they have successfully logged in to the application. It also hides teh the registration and login links that would normally be displayed in the anonymous template.
I can easily check the identity type of the request and see if it is using WindowsIdentity or FormsIdentity - if the connection comes in using WindowsIdentity and there is no auth-cookie I can capture the username and then set the identity to null. Since
the identity is null, the login view displays the anonymous template and the user is presented with the login page.
The current problem is that after login I need to reset the login view with the valid FormsIdentity after the user has authenticated - however, I have found that login view does not reset when it detects a non-null Identity.Name value, so the authenticated
template is never displayed (event though the user has an auth cookie and is logged in).
Just wondering if anyone has any ideas on how to solve this issue, or has a different solution for handling the same scenario?
Apr 10, 2014 08:34 AM|Ericzh|LINK
Hope below links help: