4 Replies - 5124 Views - Last Post: 20 April 2012 - 05:43 AM Rate Topic: -----

#1 claretrobbo  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 29
  • Joined: 19-March 12

Validating a login - Password

Posted 20 April 2012 - 01:12 AM

Hi guys basically i want to create a login to my program which uses the same username and password as windows login.

I already know how to retrieve username and auto place it in the username box using
TextBox1.Text = Environment.UserName.ToString


i wondered is there an easy way to only allow access if the password matches up to their logon? i dont know about setting up databases but i dont think this option would work because each member of staff can personally choose their password.

any ideas?

thanks liam

Is This A Good Question/Topic? 0
  • +

Replies To: Validating a login - Password

#2 DimitriV  Icon User is offline

  • They don't think it be like it is, but it do
  • member icon

Reputation: 584
  • View blog
  • Posts: 2,738
  • Joined: 24-July 11

Re: Validating a login - Password

Posted 20 April 2012 - 01:23 AM

I don't know, maybe we shouldn't be discussing things such as retrieving the Windows logon password. I don't think there is a simple way but I don't want to provide links or anything because who knows, they may be used maliciously and I would be of blame for it. Hope you understand!

A database would be better, they can be edited and customised. And they don't put logon info at risk :)
Was This Post Helpful? 0
  • +
  • -

#3 claretrobbo  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 29
  • Joined: 19-March 12

Re: Validating a login - Password

Posted 20 April 2012 - 01:36 AM

i understand what you mean but this isn't anything malicious, instead of retrieving password is there a way to check against it, if it matches then allow access? by the way we use active directory to manage users. i have had a quick look on google but can only see examples/code for C#.
Was This Post Helpful? 0
  • +
  • -

#4 DimitriV  Icon User is offline

  • They don't think it be like it is, but it do
  • member icon

Reputation: 584
  • View blog
  • Posts: 2,738
  • Joined: 24-July 11

Re: Validating a login - Password

Posted 20 April 2012 - 01:43 AM

C# is very similar to VB. You can convert the code, look at DeveloperFusion.com. I don't want to be involved with the code.
Was This Post Helpful? 0
  • +
  • -

#5 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1526
  • View blog
  • Posts: 5,961
  • Joined: 21-March 08

Re: Validating a login - Password

Posted 20 April 2012 - 05:43 AM

You would use Active Directory to do this.

This would be a simple method to use if you are using .Net 3.5 or greater...

Public Function ValidateAD(ByVal userName As String, ByVal password As String) As Boolean

   Dim valid As Boolean = False

   Using context As PrincipalContext = new PricipalContext(ContextType.Domain)

      valid = context.ValidateCredentials(userName, password)

   End Using

   Return valid

End Function



PrincipalContext
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1