windows forms using active directory
-
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.
-
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.
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.
-
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.
-
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?
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.