Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I came across a requirement, to ask user for windows credentials for a page. I gave authentication mode as windows in web.config but it is not working. Please give me suggestion. I wrote code in back page as

C#
string s = (Request.LogonUserIdentity.Name.Substring(Request.LogonUserIdentity.Name.LastIndexOf(@"\") + 1));


I hope this wrong one. I checked with Mr. Google, but of no use. Please guide me.

Thanks in Advance
Posted

1 solution

Use HttpContext.User Property

http://msdn.microsoft.com/en-us/library/system.web.httpcontext.user(v=vs.110).aspx

Thus,

C#
string user = User.Identity.Name;
 
Share this answer
 
Comments
coded007 24-Sep-14 4:36am    
It was doing same thing as previous one does but it is not displaying windows credential tile.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900