开发者

get user name asp.net windows auth

SO i made a simple web form, set开发者_Go百科 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 ?


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜