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
)
Many thanks in advance,
Rob
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
Many thanks in advance,
Rob