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. Windows Forms
  4. windows forms using active directory

windows forms using active directory

Scheduled Pinned Locked Moved Windows Forms
csharpquestionasp-netdatabasesql-server
4 Posts 2 Posters 3 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.
  • D Offline
    D Offline
    dcof
    wrote on last edited by
    #1

    I have a c#.net 2008 desktop application that I need to add logic to authenicate who the user is. I am going to use windows authenication to connect to the active directory to verify the right of each person by group. Thus I have the following question for a desktop application; 1. Do you know of a reference of that has a desktop form accessing the active directory? The only one I know about is an asp.net applcation accessing the active directory. 2. In this application, I would like the windows desktop application to pass the authenication(active directory) information to sql server 2008 r2 by either user or by group. Thus I am wondering if you can point me to some references (links and/or urls) i can use to accomplish these tasks or part of these tasks.

    G 1 Reply Last reply
    0
    • D dcof

      I have a c#.net 2008 desktop application that I need to add logic to authenicate who the user is. I am going to use windows authenication to connect to the active directory to verify the right of each person by group. Thus I have the following question for a desktop application; 1. Do you know of a reference of that has a desktop form accessing the active directory? The only one I know about is an asp.net applcation accessing the active directory. 2. In this application, I would like the windows desktop application to pass the authenication(active directory) information to sql server 2008 r2 by either user or by group. Thus I am wondering if you can point me to some references (links and/or urls) i can use to accomplish these tasks or part of these tasks.

      G Offline
      G Offline
      GenJerDan
      wrote on last edited by
      #2

      dcof wrote:

      1. Do you know of a reference of that has a desktop form accessing the active directory? The only one I know about is an asp.net applcation accessing the active directory.

      Virtually no difference in how you do it.

      dcof wrote:

      2. In this application, I would like the windows desktop application to pass the authenication(active directory) information to sql server 2008 r2 by either user or by group.

      Use Integrated Security in the connection string and it will do it for you.

      I thought you had to go to Pittsburgh for that. My Mu[sic] My Films My Windows Programs, etc.

      D 1 Reply Last reply
      0
      • G GenJerDan

        dcof wrote:

        1. Do you know of a reference of that has a desktop form accessing the active directory? The only one I know about is an asp.net applcation accessing the active directory.

        Virtually no difference in how you do it.

        dcof wrote:

        2. In this application, I would like the windows desktop application to pass the authenication(active directory) information to sql server 2008 r2 by either user or by group.

        Use Integrated Security in the connection string and it will do it for you.

        I thought you had to go to Pittsburgh for that. My Mu[sic] My Films My Windows Programs, etc.

        D Offline
        D Offline
        dcof
        wrote on last edited by
        #3

        You basically said there is Virtually no difference in how you do it. Basically how you connect a desktop application versus a asp.net to the active directory. However, can you tell me what the difference is?

        G 1 Reply Last reply
        0
        • D dcof

          You basically said there is Virtually no difference in how you do it. Basically how you connect a desktop application versus a asp.net to the active directory. However, can you tell me what the difference is?

          G Offline
          G Offline
          GenJerDan
          wrote on last edited by
          #4

          The only real difference is where you get the current user info from for your authentication. In asp, I use this function (everyone stop laughing...I never got around to cleaning it up):

          public string Whoami()
          {
          string str;
          int idx;
          str = System.Web.HttpContext.Current.Request.LogonUserIdentity.Name;
          idx = str.IndexOf("\\");
          return str.Substring(idx + 1);
          }

          But on the desktop, all you need is: string SAMS = System.Security.Principal.WindowsIdentity.GetCurrent().Name; Then diddle a little with it to get just the login: string[] SAM = SAMS.Split(Delim, StringSplitOptions.RemoveEmptyEntries); with SAM[1] being the login without the domain. After that, you can check AD to see if the user is authorized, or whatever.

          I thought you had to go to Pittsburgh for that. My Mu[sic] My Films My Windows Programs, etc.

          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