0

SO i made a simple web form, set in windows auth in iis. then i deployed it on my server and i try to log in. it prompts me a login box, i enter my infos, looks likes its working fine with active directory.

if i enter something wrong it wont work etc.

obviously i need to know who is the logged on user

Response.Write(HttpContext.Current.User.Identity.Name.ToString());

i found this in other threads, but it wont work for me...

how do i get the info filled in the login box ?

2 Answers 2

2

If you using asp.net membership provider you can get the current logged user

System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();

User.Identity.IsAuthenticated  

can be used to identify whether user successfully logged in or not

Sign up to request clarification or add additional context in comments.

3 Comments

Response.Write(System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString()); returns me AUTORITE NT\SERVICE RÉSEAU, edit , which is not the user i used to log in. i used davetest
use this to get username User.Identity.Name moreover this article got useful information regarding this social.msdn.microsoft.com/Forums/en/pex/thread/…
This method worked for me. Setting <identity impersonate="true"> didn't. In fact, setting impersonate to true gives me NT AUTHORITY\IUSR, which is the default anonymous IIS user.
1

<identity impersonate="true" /> in web config , fixed my problem.
http://msdn.microsoft.com/en-us/library/ff647076.aspx helped me.
thanks.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.