Last post Apr 17, 2014 03:44 AM by PatriceSc
Apr 14, 2014 06:49 AM|DFang6|LINK
I am trying to get Internet Explorer's "sign in as different user" and then get the username of the logged in user (not computer user). For example, i sign in as different user "LLL" and when i start a page with that page it would display "LLL" Can anyone
help? i tried identity, httpwebrequest
Apr 14, 2014 07:06 AM|PatriceSc|LINK
And what happens with what you tried ? Do you see no user name at all or do you see the user who opened the session ? If using Windows authentication and User.Identity.Name, it should work.
Else show User.Identity.IsAuthenticated and User.Identity.AuthenticationType, as long as you don't have proper values here, User.Identity.Name won't work either.
Finally make sure to close all other IE instances before launcing IE using "Run as another user"...
Apr 14, 2014 07:42 AM|DFang6|LINK
User.Identity.Name bears no result
IsAuthenticated shows false, AuthenticationType shows nothing
HTTPContext.Current.User.Identity.Name shows no result either
Apr 14, 2014 08:34 AM|markfitzme|LINK
The current user functionality only works if you are using an asp.net authentication system such as windows, forms, etc.. IE itself doesn't have a built in "sign in as a different user". That would either a) be a function of the website where you sign into
or b) some sort of plug-in designed to remember passwords for a website.
Apr 14, 2014 08:34 AM|Rion Williams|LINK
How are you currently handling authentication within your application?
The previously suggested properties of User.Identity.Name should reveal the name of the user that is currently logged in. If it is not returning anything, then it's likely that your authentication may not be working as you intended.
Could you provide any details as to how you are currently authentication your user? Are you using
Forms Authentication? Or are you attempting to manually handle this through your own logic?
Apr 14, 2014 08:55 AM|PatriceSc|LINK
So for now your website doesn't use any authentication. You have to enable authentication. See
http://msdn.microsoft.com/en-us/library/aa292114(v=vs.71).aspx for possible choices. It looks like you want Windows authentication.
As long as IsAuthenticated is false, you won't have any way to know who is connected.
How can it be that you seems to be able to sign as a particular user and still you don't know anything about the connected user ? Could it be that you tried to create your own authentication mechanism rather than reusing what is provided by ASP.NET/IIS ?
Which authentication method do you tried to use ?
Apr 15, 2014 12:35 AM|DFang6|LINK
I tried windows and forms but still false
Apr 15, 2014 03:58 AM|DFang6|LINK
Please teach me. Its my first time doing such thing.... I just want to get the user logged into the website
Apr 17, 2014 03:23 AM|Happy Chen - MSFT|LINK
i would suggest you check out the links below for details:
Why does HttpContext.Current.User.Identity.Name return blank
Getting A Users Username in ASP.NET
Apr 17, 2014 03:44 AM|PatriceSc|LINK
Do you have disabled user authentication ? Which version of IIS or IISExpress ? If you are at the dev step and testing on your own box see :
(last screenshot in the SSL section, you have the "Anonymous" and "Windows" authentication (disable the first and enable the later))...