Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Using Windows login credential in C# Application

Using Windows login credential in C# Application

Scheduled Pinned Locked Moved C#
questioncsharp
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MayukhSen
    wrote on last edited by
    #1

    i am developing a Desktop Application in c# where user have to give username and password to login. This application runs when windows starts. Now user have to give password for login to windows and then again the have to login in my application. My question is is there any option to get the login credential so that user have to login once for windows and my application? Thanks in advance.

    R realJSOPR 2 Replies Last reply
    0
    • M MayukhSen

      i am developing a Desktop Application in c# where user have to give username and password to login. This application runs when windows starts. Now user have to give password for login to windows and then again the have to login in my application. My question is is there any option to get the login credential so that user have to login once for windows and my application? Thanks in advance.

      R Offline
      R Offline
      R Giskard Reventlov
      wrote on last edited by
      #2

      You are saying that the user logging into Windows is, by default, the same one logging into your application at start-up? So why bother logging them in at all? Assume it is the same user and start your application. Unless you have another reason for tracking who is logged in to your application? Then you could use one of these or similar: Environment.UserName System.Windows.Forms.SystemInformation.UserName

      me, me, me "The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!" Larry Niven nils illegitimus carborundum

      M 1 Reply Last reply
      0
      • R R Giskard Reventlov

        You are saying that the user logging into Windows is, by default, the same one logging into your application at start-up? So why bother logging them in at all? Assume it is the same user and start your application. Unless you have another reason for tracking who is logged in to your application? Then you could use one of these or similar: Environment.UserName System.Windows.Forms.SystemInformation.UserName

        me, me, me "The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!" Larry Niven nils illegitimus carborundum

        M Offline
        M Offline
        MayukhSen
        wrote on last edited by
        #3

        one user can logout at any time from Application without loogin off from windows. and other user have to login into the application before the use the particular machine. so i have to keep separate user database form my application.

        realJSOPR 1 Reply Last reply
        0
        • M MayukhSen

          i am developing a Desktop Application in c# where user have to give username and password to login. This application runs when windows starts. Now user have to give password for login to windows and then again the have to login in my application. My question is is there any option to get the login credential so that user have to login once for windows and my application? Thanks in advance.

          realJSOPR Offline
          realJSOPR Offline
          realJSOP
          wrote on last edited by
          #4

          You could check to see if the currently logged-in user is part of a particular group, and if so, just let them use the program. Otherwise, make them enter a password.

          .45 ACP - because shooting twice is just silly
          -----
          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
          -----
          "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

          1 Reply Last reply
          0
          • M MayukhSen

            one user can logout at any time from Application without loogin off from windows. and other user have to login into the application before the use the particular machine. so i have to keep separate user database form my application.

            realJSOPR Offline
            realJSOPR Offline
            realJSOP
            wrote on last edited by
            #5

            montosen wrote:

            one user can logout at any time from Application without loogin off from windows

            Then there's absolutely no way to use the current windows login info for anything beyond retrieving the currently logged-in user. If anothger user can come along and start using apps on another user's logon credentials, the app MUST ask for user ID and password.

            .45 ACP - because shooting twice is just silly
            -----
            "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
            -----
            "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

            M 1 Reply Last reply
            0
            • realJSOPR realJSOP

              montosen wrote:

              one user can logout at any time from Application without loogin off from windows

              Then there's absolutely no way to use the current windows login info for anything beyond retrieving the currently logged-in user. If anothger user can come along and start using apps on another user's logon credentials, the app MUST ask for user ID and password.

              .45 ACP - because shooting twice is just silly
              -----
              "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
              -----
              "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

              M Offline
              M Offline
              MayukhSen
              wrote on last edited by
              #6

              yeha! :( i guess ur right.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups