AD Authentication From Windows Forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If I want to authenticate a user against AD from a WinForms app, how do I go about it? I want a user to have to re-authenticate after a timeout period. I will assume the user is the currently logged on user, but I want to prompt for a password and authenticate them against AD. What's the best (and secure) way to do this. Thanks.

Jerry
 
Hi Jerry,

I am sorry that I may not understand your question exactly.
If I want to authenticate a user against AD from a WinForms app, how do I
go about it?

Could you tell me what you mean by "against AD from a WinForms app"?
I want a user to have to re-authenticate after a timeout period.

This feature is commonly used in web app, in which case we usually make use
of Session object on Web Server side. If you want to implement this
function in WinForms app, I think you may use Timer component to do it. Set
the Interval property of the Timer and handle its Tick event to require the
user to input a password.

I look forward to your reply.


Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
My question is not about how to deal with the timeout. I want to know how,
if given a user name and password, to determine if that is a valid AD user.
This is a WinForms app, not a web app. Thanks.

Jerry
 
The two ways I have seen this done so far is you can go down to the WinAPI
in unmannaged code and validate that way or you can try using the
System.Web.Security.Membership class and call the ValidateUser method,
passing in the <username>@<domain> and <password>. As you are using a
WinForms app, I'm not sure if the Web class will work for you but I believe
it will....
 
Hi Jerry,

You should use the classes in the System.DirectoryServices to
authentication against Active Directory.

The following link is a sample of authentication against AD in ASP.Net, but
I think you could apply the rule of authentication to WinForms application.

http://support.microsoft.com/?id=326340

Hope this helps.
If you have anything unclear, please feel free to let me know.


Sincerely,
Linda Liu
Microsoft Online Community Support
 
Hi Jerry,

How about your solving the problem?

If the problem is not solved or you need our further help, please feel free
to tell me.

Thank you for using our MSDN Managed Newsgroup Support Service!


Sincerely,
Linda Liu
Microsoft Online Community Support
 
Back
Top