.NET Framework Bookmark and Share   
 index > Network Class Library (System.Net) > getting active directory username
 

getting active directory username

HI

My scenario is that i am using Active Directory user to login on my web application so i didnt want to re authenticate user when he access my web application(it ll automatically be authenticated). SO i need active windows client username in my web application. I try HttpContext but it give null value on Client side. On Deployment senario HttpContext return null value.
maz3tt

> I try HttpContext but it give null value on Client side

That's not too surprising, HttpContext is intended to be used on the server side as part of your ASP.NET application.

The analog on the client side would be:

            using (var wi = System.Security.Principal.WindowsIdentity.GetCurrent())
            {
                Console.WriteLine(wi.Name);
            }

As to actually pulling this off, you will probably also need to make sure that IIS is enabled for Windows Authentication mode.

BinaryCoder
I have solved it by using hostname instead of ip of the server and the reauthentication windows popup is not appearing anymore.
  • Marked As Answer bymaz3tt Wednesday, September 16, 2009 1:04 AM
  •  
maz3tt

> I try HttpContext but it give null value on Client side

That's not too surprising, HttpContext is intended to be used on the server side as part of your ASP.NET application.

The analog on the client side would be:

            using (var wi = System.Security.Principal.WindowsIdentity.GetCurrent())
            {
                Console.WriteLine(wi.Name);
            }

As to actually pulling this off, you will probably also need to make sure that IIS is enabled for Windows Authentication mode.

BinaryCoder
I have solved it by using hostname instead of ip of the server and the reauthentication windows popup is not appearing anymore.
  • Marked As Answer bymaz3tt Wednesday, September 16, 2009 1:04 AM
  •  
maz3tt

You can use google to search for other answers

Custom Search

More Threads

• problem downloading binary file
• Loop and Webclient
• Solve RRAS Hangup Problem in .Net 1.1
• Wireless Network Programming
• Is this Server Efficent (Listening Method)- Case1
• Post HTTP Headers to log into forums
• How to assign Base64 Encoding method of the MIME header in MailMessage class
• sending SMS
• How to set encoding of the send data of an HttpWebRequest
• SMTP sending failure on windows service