ASP & Active Directory

H

Hermes

Hi all,

We have a web page which validates users againt active directory (kinda),
Effectively the code we use will check the user's password and if successful
creates some session's for what access they have in the internal site. We
have noticed though that the query against the LDAP doesnt seem to
disconnect and by doing a netstat -a we get alot of ports with an
ESTABLISHED status on the LDAP server. When this gets to around 200 it goes
verrrrrrrrrrrrryyyyyyyyy slow on the site. If we do an unload on the IIS
they get released and goes back to normal speed.

e.g.
TCP IISbox:4597 ldap.domainname.co.uk:ldap ESTABLISHED
TCP IISbox:4649 ldap.domainname.co.uk:ldap ESTABLISHED
TCP IISbox:4652 ldap.domainname.co.uk:ldap ESTABLISHED
TCP IISbox:4664 ldap.domainname.co.uk:ldap ESTABLISHED

The following is the code,

<%@ Language = VBScript %>
<%
on error resume next
Dim strADsPath
Dim strUserName
Dim strPassword
Dim iFlags
Dim strFullADsPath
Dim strFullUserName
Dim strADsNamespace
Dim oADsNamespace
Dim oADsObject
Session.Timeout=480
session("username") = request.form("username")
strADsPath = "DOMAIN-NAME"
strUserName = Request.Form("UserName")
strPassword = Request.Form("Password")
iFlags = "0"
strFullADsPath = "WinNT://"&strADsPath
strFullUserName = strADsPath&"\"&strUserName
Set oADsObject = GetObject(strFullADsPath)
strADsNamespace = left(strFullADsPath, instr(strFullADsPath, ":"))
set oADsNamespace = GetObject(strADsNamespace)
Set oADsObject = oADsNamespace.OpenDSObject(strFullADsPath,
strFullUserName, strPassword, 0)
if err.number = 0 then
Session("user_logged_in") = "true"
strUserName = session("username")
Set oUser = GetObject("WinNT://" & strADsPath & "/" & strUserName &
",user")
GetUserFullName = oUser.FullName
if oGroup.Name = "Domain Admins" then
session("Group1") = "true"
session("Group2") = "true"
session("Group3") = "true"
end if
set strADsPath = nothing
set strUserName = nothing
set strPassword = nothing
set iFlags = nothing
set strFullADsPath = nothing
set strFullUserName = nothing
set strADsNamespace = nothing
set oADsNamespace = nothing
set oADsObject = nothing
Set oUser = nothing
else
Response.Redirect "denied_logout.asp"
end if
end if
%>

Any comments or suggestions are gladly welcome :eek:)
Many thanks in advance,
Rob
 
J

Jeff Dillon

You are setting objects to nothing only in one half of your subsequent IF
statement

Jeff
 
H

Hermes

Hi Jeff,

Couldnt see the light for the light, it seems to of kinda worked, still
getting them come up on the netstats but not as many now, so i'm going to go
through the code on a few other pages which validates later on in the site.
Do you know of anyway to close the connection other than setting them all
the nothing?

Cheers,
Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top