Groups | Blog | Home
all groups > inetserver asp general > september 2004 >

inetserver asp general : ASP & Active Directory



Jeff Dillon
9/30/2004 1:51:22 PM
You are setting objects to nothing only in one half of your subsequent IF
statement

Jeff
[quoted text, click to view]

Hermes
9/30/2004 7:14:53 PM
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 :o)
Many thanks in advance,
Rob

jeff.nospam NO[at]SPAM zina.com
9/30/2004 8:10:50 PM
On Thu, 30 Sep 2004 19:14:53 +0000 (UTC), "Hermes" <nospam@nospam.com>
[quoted text, click to view]

Have you tried closing your objects? As in:

oADsObject.close
oADsNamespace.close

Jeff

[quoted text, click to view]
Hermes
9/30/2004 11:57:36 PM
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
[quoted text, click to view]

AddThis Social Bookmark Button