CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    762

    Using the Windows Username and Password

    I've noticed in other Applications like iTunes 6, they use the Windows password to authenticate for different functions. How could I do this in C#? Is there .Net functionality for this in 1.0, 1.1, or 2.0? Or would I need to use some APIs?

  2. #2
    Join Date
    Dec 2002
    Location
    London, UK
    Posts
    1,569

    Re: Using the Windows Username and Password

    Yes. I can't remember exactly where/what to look for but think it is under the System.Authentication namespace.
    Mike

  3. #3
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: Using the Windows Username and Password

    Quote Originally Posted by kasracer
    I've noticed in other Applications like iTunes 6, they use the Windows password to authenticate for different functions. How could I do this in C#? Is there .Net functionality for this in 1.0, 1.1, or 2.0? Or would I need to use some APIs?
    Well to be more specific you can use the Authentication but you will never be able to get the password as a string. You could use Environment.Username to get the username and similarly Environment.UserDomainName to get the domain name. You could even use System.Security.Principal.WindowsIdentity.GetCurrent() Method to get other things also.

    What exactly are you trying to do?

  4. #4
    Join Date
    Sep 2004
    Location
    Tehran(Ir)
    Posts
    469

    Re: Using the Windows Username and Password

    another way is to determine in which Windows Group the current user is belonging to.
    WindowsPrincipal.IsInRole method accepts WindowsBuiltInRole Enum as an argument for representing the local Windows groups.

  5. #5
    Join Date
    Aug 2004
    Posts
    8

    Re: Using the Windows Username and Password

    If I need username and password to connect to proxy. How can i do?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured