473,385 Members | 1,355 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,385 software developers and data experts.

Active Directory null result

I am using VS.NET 2005 to build a Web Application. I need to Query
Active Directory to find to which "Department" the current logged in
User belongs.

in web.config i have set Windows Authentication and identity
impersonate to true.
On my development computer, without a problem i can build the
application and the query returns the "Department" of the particular
user using the following code:

Dim entry As New DirectoryEntry("LDAP://dc=mot,dc=gov")
Dim Dsearch As New DirectorySearcher(entry)
Dsearch.Filter = "(&(objectClass=user)(sAMAccountName=" +
Environment.UserName + "))"
Dim search As SearchResult = Dsearch.FindOne
If Not (search Is Nothing) Then
labSection.Text =
search.GetDirectoryEntry.Properties.Item("Departme nt").Value
Else
labSection.Text = "Empty"
End If

But once i put the files on the WIndows 2000 Server IIS virtual
directory i get the page but the labSection shows "Empty".

in the IIS directory security , Under "Authentication Methods" i have
ticked only "Intergrated Windows Authentication"

I am using asp.net version 2.0

After searching & reading forums, i am still unable to find the reason
for this. Please help as i am stuck on this for more than a week. Any
suggestion or alternative methods are welcome.

Dec 14 '06 #1
0 1411

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

Similar topics

1
by: Toufani | last post by:
Hi everybody, I want to retrieve information about objects in active directory windows 2000 and their properties. I got some codes that don't work absolutely. for example I can't retrieve users...
10
by: huzz | last post by:
I have web application that quaries the Active Directory to get user details.. everything works fine but someday I'll get System.Runtime.InteropServices.COMExection and if I restart the client...
0
by: Kenneth Keeley | last post by:
Hi, I have been working on a Login page that uses ADSI to authenicate the users. I had this all working on my test system and on a second system connected to the live domain. Now it will only work...
12
by: JIM.H. | last post by:
Hello, Here is my code that I got from internet and I am assuming this give me e-mail address of the people in the active directory. Private Sub Page_Load(ByVal sender As System.Object, ByVal e...
1
by: tangus via DotNetMonster.com | last post by:
Hello all, I'm really struggling with getting some Active Directory code to work in ASP.NET. Can you please provide assistance? I am executing the following code: Dim enTry As DirectoryEntry =...
10
by: Hriday | last post by:
Hi there, Please help me..It is urgent This is Hriday, working on windows authentication with Active Directory... My requirment is when a user sends a request to my web Applicatoin I want to...
0
by: Chung Leong | last post by:
In this brief tutorial I'll describe how you retrieve information from an Active Directory through the OLE-DB extension. While it is possible to use the LDAP extension to achieve the same goal, as...
2
by: piggy | last post by:
I have a login name with user name and password. based on provided username and password, those infor will be looked up in the active directory for a specific group to authenticate users. Could...
2
by: j.m.osterman | last post by:
I haven't found exactly what I've been trying to do. All I am trying to do for now is just display usernames from Active Directory into a ListBox control on a page. I have found some code...
3
by: =?Utf-8?B?QlVCQkxFVEFMSzI2MA==?= | last post by:
Hello. I am writing an application that uses Active Directory and needs to grab user information. I pass user email addresses and and get back a userInfo structure with AD information. My issue is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.