473,806 Members | 2,878 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP <-> LDAP

Hi,

i have a problem in the following source code, i cant read the department
from the AD ;(
where is my mistake?

Dim strBrowser 'Brausertyp

If Request.ServerV ariables("LOGON _USER") = "" Then
Response.Status = "401 Unauthorized"
Response.End
End If

Dim strUserADsPath 'ADSI user ads path
Dim objUser 'ADSI user object
Dim strADSPath 'ADS path

Dim strUserID 'User Name
Dim strUserDomain 'User Domain
Dim intSlash 'Hilfsvariable zum trennen von Domain und User
Dim strSpath 'Suchpfad im AD

Dim rs 'ADODB Recordset
Dim con 'Handle zur ADODB Verbindung
Dim ocommand 'ADODB Query Command

Dim strVorname
Dim strNachname
Dim strEmail
Dim strKostenstelle

strUserAdsPath = Request.ServerV ariables("LOGON _USER")

intSlash = instr(1,strUser AdsPath,"\")

strUserDomain = mid(strUserAdsP ath,1,intSlash -1 )
strUserID = mid(strUserAdsP ath,intSlash + 1 ,(len(strUserAd sPath)))
strSpath = "LDAP://dc=" & strUserDomain & ",dc=domain,dc= com"
'ADO Connection object
Set con = CreateObject("A DODB.Connection ")
con.Provider = "ADsDSOObje ct"
con.Open "Active Directory Provider"

'ADO Command object
Set ocommand = CreateObject("A DODB.Command")
ocommand.Active Connection = con
ocommand.Comman dText = "<" & strSpath &
">;(&(objectCat egory=person)(o bjectClass=user )(givenName=Fab ian)(sn=Baum)); a
dsPath,name,ou; subTree"

Set rs = ocommand.Execut e
Do While Not(rs.EOF)

' Connecten zum User im AD
strUserADsPath = rs.Fields(0).va lue

set objUser = GetObject(strUs erADsPath)

strVorname = objUser.givenNa me
strNachname = objUser.sn
strEmail = objUser.mail
strKostenstelle = objUser.descrip tion
strNTUser = objUser.cn
strAbteilung = objUser.departm ent

Response.Write "<br>SN: " & objUser.departm ent

rs.MoveNext
loop
Set objUser = Nothing

set con = Nothing
set ocommand = Nothing
Jul 22 '05 #1
0 1216

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

Similar topics

5
2382
by: Jonny T | last post by:
hi, i want to echo the string '<?php' in a php script like : echo "<?php"; but when i try nothing gets displayed ... if I use echo "<\?php";
7
5179
by: haoren | last post by:
Can anybody help me with this problem: How can I echo a string that contain <? and <?php? For example, $str="test <? and <?php echo"; echo $str;
3
1974
by: winderjj | last post by:
Hi All, I need everyones opinion. I am very new to XML but am temporarily putting all my efforts into using it. This is what I need to do. Write an xml parser (in C) that will parse a fairly complicated XML file that is full of technical data(most scalar values). Then I need to store all the info in a C structure. Could some people give me their opinion. Which is better suited for this, Expat or LT xml?
4
9657
by: matatu | last post by:
Hi to all, I have a xml file, a substring like: &lt;a href=&quot;#&quot;&gt;text&lt;/a&gt; which after an xslt trasform is rendered as (using xsl:output method html): &lt;a href="#"&gt;text&lt;/a&gt;
4
62124
by: higabe | last post by:
Three questions 1) I have a string function that works perfectly but according to W3C.org web site is syntactically flawed because it contains the characters </ in sequence. So how am I supposed to write this function? String.replace(/</g,'&lt;');
5
3545
by: tobbe | last post by:
Hi Im trying to load a XmlDataDocument with the following xml: <ROOT> <NAME> &LT; &AMP; &GT; " '</NAME> </ROOT> And i know I have a entity problem here, but i cant find any solution for it. The problem is that i recive this from external source and cant
10
42972
by: Jon Noring | last post by:
Out of curiosity, may a CDATA section appear within an attribute value with datatype CDATA? And if so, how about other attribute value datatypes which accept the XML markup characters? To me, the XML specification seems a little ambiguous on this, so I defer to the XML authorities. Refer to sections 2.4 and 2.7 (it all hinges on if CDATA attribute values are part of markup or not.) Thanks.
4
1920
by: Armel Asselin | last post by:
Hello, I've been using XML for a while in a rather 'free' manner (i.e. as long as IE accept it it's OK), I read recently (again) the Xml standard 1.0 (3rd edition) and found this sentence: Well-formedness constraint: No < in Attribute Values The replacement text of any entity referred to directly or indirectly in an attribute value MUST NOT contain a <.
4
1816
by: spibou | last post by:
I saw it at http://www.faqs.org/rfcs/rfc1305.html Is it not the same as writing ``if (m)'' ?
3
4031
by: webmasterATflymagnetic.com | last post by:
Folks, I'm struggling to put the question together, but I have this problem. I have written an HTML form that I can use for data entry. This uses PHP to write a SQL UPDATE command that gets written to my MySQL database. I can later view this data back in the form. One thing I've noticed happening is if I enter code such as &lt; it gets rewritten as < (ie the less-than sign). Now I don't want this to happen, but something somewhere is...
0
9719
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9597
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10371
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10110
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9187
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3850
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.