locked
Best way to get user login from LDAP RRS feed

  • Question

  • User442275730 posted

    We have a ldap and active directory for our windows ten domain, I need to be able to let users either

    1. Login with their username and password that they use for their pc each morning

      or
    2. Allow auto sign on based on their initial login of their pc?.

    Any Good code examples.

    Monday, March 7, 2016 2:26 PM

Answers

All replies

  • User1124521738 posted

    if this is an asp.net web app, you can just configure the website to use windows auth and so long as the users are using IE/Edge, their credentials will seamlessly pass to the application, other browsers may require the users to enter their domain logon/password, so long as the web server and the end user computers are all in the same domain, no LDAP code needed.

    https://www.iis.net/configreference/system.webserver/security/authentication/windowsauthentication

    https://www.iis.net/configreference/system.webserver/security/authentication/windowsauthentication/providers/add

    to get the current user System.Security.Principal.WindowsIdentity.GetCurrent() or you can use one of the several Request.ServerVariable keys to get the user name.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 7, 2016 5:30 PM
  • User-986267747 posted

    Hi david38ni,

    david38ni

    Login with their username and password that they use for their pc each morning

    Here is tutorial about using Forms authentication to permit users to authenticate against Active Directory using the Lightweight Directory Access Protocol (LDAP)

    https://msdn.microsoft.com/en-us/library/ms180890(v=vs.80).aspx

    david38ni

    Allow auto sign on based on their initial login of their pc?.

    You could put your login information into a cookie variable, then you could check if the cookie is existing when you access the related pages, if it exists, the user will be redirected to related page, otherwise the user will be redirected to login page.

    Best regards,

    Klein Zhang

    Tuesday, March 8, 2016 8:52 AM