473,387 Members | 1,603 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

LDAP for logon

Hello All

I am trying to write a vb.net windows application, this application will have a logon that I want to "tie" to the Active Directory that is running on the network. Where do I look to get started integrating with LDAP. Is it easy to program the Logon feature? Is there some sample code out there

Thank
Brad
Nov 20 '05 #1
5 2011
No answers here I'm afraid Brad, but just to say that I don't really
understand exactly what it is you're trying to achieve. I have a windows
forms app that checks who the logged in user is and only allows access if
they are a member of a particular AD group (or groups). Is that what you're
after? If not, it'll probably be worth a repost with an example of what
functionality you want.
"Brad" <an*******@discussions.microsoft.com> wrote in message
news:73**********************************@microsof t.com...
Hello All,

I am trying to write a vb.net windows application, this application will have a logon that I want to "tie" to the Active Directory that is running on
the network. Where do I look to get started integrating with LDAP. Is it
easy to program the Logon feature? Is there some sample code out there?
Thanks
Brad

Nov 20 '05 #2
No answers here I'm afraid Brad, but just to say that I don't really
understand exactly what it is you're trying to achieve. I have a windows
forms app that checks who the logged in user is and only allows access if
they are a member of a particular AD group (or groups). Is that what you're
after? If not, it'll probably be worth a repost with an example of what
functionality you want.
"Brad" <an*******@discussions.microsoft.com> wrote in message
news:73**********************************@microsof t.com...
Hello All,

I am trying to write a vb.net windows application, this application will have a logon that I want to "tie" to the Active Directory that is running on
the network. Where do I look to get started integrating with LDAP. Is it
easy to program the Logon feature? Is there some sample code out there?
Thanks
Brad

Nov 20 '05 #3
Rob, thats exactly what im looking for too, any examples would be grateful

"Rob Oldfield" <rob@oldfield100_wow_freeserve_yikes_co_incredible !_uk> wrote
in message news:O%****************@TK2MSFTNGP12.phx.gbl...
No answers here I'm afraid Brad, but just to say that I don't really
understand exactly what it is you're trying to achieve. I have a windows
forms app that checks who the logged in user is and only allows access if
they are a member of a particular AD group (or groups). Is that what you're after? If not, it'll probably be worth a repost with an example of what
functionality you want.
"Brad" <an*******@discussions.microsoft.com> wrote in message
news:73**********************************@microsof t.com...
Hello All,

I am trying to write a vb.net windows application, this application will have a logon that I want to "tie" to the Active Directory that is running

on the network. Where do I look to get started integrating with LDAP. Is it
easy to program the Logon feature? Is there some sample code out there?

Thanks
Brad


Nov 20 '05 #4
OK. Some functions that I use....

Imports System.Security.Principal

'Returns current user
Public Function CurrentUser()
Dim pos As Integer, fullname As String
fullname = System.Security.Principal.WindowsIdentity.GetCurre nt().Name
'Just to get at the username after the 'domainname\' Should really use
Substring instead of Mid
pos = InStr(fullname, "\", CompareMethod.Text)
CurrentUser =
Mid(System.Security.Principal.WindowsIdentity.GetC urrent().Name, pos + 1)
End Function
'To test whether user is a member of a group
Private Function InGroup(ByVal grp As String) As Boolean
Dim id As WindowsIdentity
id = WindowsIdentity.GetCurrent()
Dim p As New WindowsPrincipal(id)
InGroup = p.IsInRole("YourDomainName\" + grp)
End Function

....and a sample Sub Main()....

Sub Main()
dim msg as string
If InGroup("AppUsers") Then
Application.Run(New YourMainForm)
Else
msg = "You are not a registered user. Please go away."
MessageBox.Show(msg, "Invalid user", MessageBoxButtons.OK)
End If
End Sub
"Rod Barrand" <rb******@johnstonnsmclamb.com> wrote in message
news:u8**************@tk2msftngp13.phx.gbl...
Rob, thats exactly what im looking for too, any examples would be grateful

"Rob Oldfield" <rob@oldfield100_wow_freeserve_yikes_co_incredible !_uk> wrote in message news:O%****************@TK2MSFTNGP12.phx.gbl...
No answers here I'm afraid Brad, but just to say that I don't really
understand exactly what it is you're trying to achieve. I have a windows forms app that checks who the logged in user is and only allows access if they are a member of a particular AD group (or groups). Is that what you're
after? If not, it'll probably be worth a repost with an example of what
functionality you want.
"Brad" <an*******@discussions.microsoft.com> wrote in message
news:73**********************************@microsof t.com...
Hello All,

I am trying to write a vb.net windows application, this application
will have a logon that I want to "tie" to the Active Directory that is

running on
the network. Where do I look to get started integrating with LDAP. Is it
easy to program the Logon feature? Is there some sample code out there?

Thanks
Brad



Nov 20 '05 #5
excellent
"Rob Oldfield" <sf**@sdfsdf.sdfs> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
OK. Some functions that I use....

Imports System.Security.Principal

'Returns current user
Public Function CurrentUser()
Dim pos As Integer, fullname As String
fullname = System.Security.Principal.WindowsIdentity.GetCurre nt().Name
'Just to get at the username after the 'domainname\' Should really use Substring instead of Mid
pos = InStr(fullname, "\", CompareMethod.Text)
CurrentUser =
Mid(System.Security.Principal.WindowsIdentity.GetC urrent().Name, pos + 1)
End Function
'To test whether user is a member of a group
Private Function InGroup(ByVal grp As String) As Boolean
Dim id As WindowsIdentity
id = WindowsIdentity.GetCurrent()
Dim p As New WindowsPrincipal(id)
InGroup = p.IsInRole("YourDomainName\" + grp)
End Function

...and a sample Sub Main()....

Sub Main()
dim msg as string
If InGroup("AppUsers") Then
Application.Run(New YourMainForm)
Else
msg = "You are not a registered user. Please go away."
MessageBox.Show(msg, "Invalid user", MessageBoxButtons.OK)
End If
End Sub
"Rod Barrand" <rb******@johnstonnsmclamb.com> wrote in message
news:u8**************@tk2msftngp13.phx.gbl...
Rob, thats exactly what im looking for too, any examples would be grateful

"Rob Oldfield" <rob@oldfield100_wow_freeserve_yikes_co_incredible !_uk>

wrote
in message news:O%****************@TK2MSFTNGP12.phx.gbl...
No answers here I'm afraid Brad, but just to say that I don't really
understand exactly what it is you're trying to achieve. I have a

windows forms app that checks who the logged in user is and only allows access if they are a member of a particular AD group (or groups). Is that what

you're
after? If not, it'll probably be worth a repost with an example of what functionality you want.
"Brad" <an*******@discussions.microsoft.com> wrote in message
news:73**********************************@microsof t.com...
> Hello All,
>
> I am trying to write a vb.net windows application, this application will have a logon that I want to "tie" to the Active Directory that is

running
on
the network. Where do I look to get started integrating with LDAP. Is it easy to program the Logon feature? Is there some sample code out there? >
> Thanks
> Brad



Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: MickBim | last post by:
Hi, I'm developping a module in PHP to get the users of a LDAP server and add them in a Postgre database, where normal users are too. I've managed to do this "easily" but now a new problem...
5
by: Ram | last post by:
Hey, I'v managed to set the "User Must Change Password At Next Logon" flag on the LDAP protocol, Using the - "pwdLastSet" property - by setting it to - "0" (for on) or - "-1" (for off). The...
7
by: Sync Walantaji | last post by:
Hi, I would like to write a asp.net winform program to authenticate users on Active Directory. Can I do this with asp.net if the IIS server is not part of the Active directory domain? Is...
2
by: Serline | last post by:
I can login to the domain hosted by Win 2003. However when my .NET application trys to authenticate using NTLM with LDAP on Win 2003, I'm encountering problems. It's showing "The authentication...
2
by: Brad | last post by:
Hello All I am trying to write a vb.net windows application, this application will have a logon that I want to "tie" to the Active Directory that is running on the network. Where do I look to get...
1
by: Ram | last post by:
Hey, I'v managed to set the "User Must Change Password At Next Logon" flag on the LDAP protocol, Using the - "pwdLastSet" property - by setting it to - "0" (for on) or - "-1" (for off). The...
3
by: Steve Lloyd | last post by:
Hi, I am trying to get someones email address out of the win 2003 server Directory using there logon name and the following code. Dim DSEntry As New...
8
by: BookerW | last post by:
I have the following line of code, but i don't think i am providing the right syntax: Dim oAllEntries As New DirectoryEntry(LDAP & LDAP_DOMAIN_SERVER & LDAP_USERS, LDAP_DOMAIN & sUserName,...
3
by: RJN | last post by:
Hi I've written a code that queries Windows LDAP server and works fine, but the same doesn't work when querying Solaris LDAP server. DirectoryEntry de = new...
3
by: aydeejay | last post by:
I'm trying to troubleshoot an issue where users are not able to bind with LDAP via "GetObject" through our ASP Classic Intranet if they stay logged in overnight (beyond their allowed login hours). ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.