Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > ASP & Active Directory

Reply
Thread Tools

ASP & Active Directory

 
 
Hermes
Guest
Posts: n/a
 
      09-30-2004
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


 
Reply With Quote
 
 
 
 
Jeff Cochran
Guest
Posts: n/a
 
      09-30-2004
On Thu, 30 Sep 2004 19:14:53 +0000 (UTC), "Hermes" <(E-Mail Removed)>
wrote:

Have you tried closing your objects? As in:

oADsObject.close
oADsNamespace.close

Jeff

>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
>


 
Reply With Quote
 
 
 
 
Jeff Dillon
Guest
Posts: n/a
 
      09-30-2004
You are setting objects to nothing only in one half of your subsequent IF
statement

Jeff
"Hermes" <(E-Mail Removed)> wrote in message
news:cjhlvd$qel$(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Hermes
Guest
Posts: n/a
 
      09-30-2004
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
"Jeff Dillon" <(E-Mail Removed)> wrote in message
news:%23P8V%(E-Mail Removed)...
> You are setting objects to nothing only in one half of your subsequent IF
> statement
>
> Jeff
> "Hermes" <(E-Mail Removed)> wrote in message
> news:cjhlvd$qel$(E-Mail Removed)...
>> 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
>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System.IO.Directory.GetDirectories() and System.IO.Directory.GetFiles() are not returning the specified directory Nathan Sokalski ASP .Net 2 09-06-2007 03:58 PM
Active Directory Search fails ("The directory service is unavailab ejcosta ASP .Net Security 2 10-08-2004 09:57 AM
Active Directory information in .ASP Frank ASP .Net 0 08-25-2003 11:54 AM
ASP ERROR: error '8002801d' -> Library not registered. : my Active Server Pages are not so active. carlos seramos ASP General 2 08-01-2003 02:57 AM
Do you need Framework 1.1 to access Active Directory objects on a Windows 2003 server with ASP.NET? Michael ASP .Net 1 07-31-2003 07:03 AM



Advertisments