Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 13th, 2004, 02:22 AM
Registered User
 
Join Date: Jul 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default WinNT Problem!

I have a login script which authenticate with AD using WinNT. But when more than 700 users login at the same time, the connection with AD will be lost. It coudln't authenticate anymore unless I restart my webserver.

I tried many script which using LDAP. But it always give me errors (e.g. table not exists or cannot execute). I even tried a script on planetsourcecode(ldap using ASP and JAVA). I still couldn't get it work.

Please help. Is very urgent! I just need a LDAP+ASP code.!
 
Old July 13th, 2004, 03:44 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to acdsky
Default

Hi

Dunno if this will help u but this is what I normally use in ASP/VB projects to authenticate users. It uses th Active DS Type Library. (activeds.tlb) I got allot of this of the net so cheers to those people. In this piece I did a check on a SQL DB as well which u might wanna loose before trying out.

Code:
<%@ Language = VBScript %> 
<html> 
<head> 
<title>Login</title> 
</head> 
<body> 
<% 
on error resume next 
Dim strDomain 
strDomain = Request.Form("ADsPath") 
Dim strADsPath 
strADsPath = strDomain 
Dim strUserName 
strUserName = Request.Form("UserName") 
Dim strPassword 
strPassword = Request.Form("Password") 
Dim iFlags 
iFlags = Request.Form("Flags") 
%> 
<br> 
<form action = "Login.asp" method = "post" id=form1 name=form1> 
  <table align="center">
    <tr> 
      <td><INPUT type="hidden" id=ADsPath name=ADsPath size = 60 value = "myDomain.com"> 
        <br></td>
    </tr>
    <tr> 
      <td>UserName:</td>
      <td><INPUT type="text" id=UserName name="UserName" size = 20 value=<%response.write strUserName%>>
        </td>
    </tr>
    <tr> 
      <td>Password:</td>
      <td> 
        <INPUT type="password" id=Password name="Password" size = 20 value = <% Response.Write strPassword%> >
        </td>
    </tr>
    <INPUT type="Hidden" id=Flags name=Flags size = 10 value = 0>
  </table>
<table align="center">
<tr>
<td><INPUT type="submit" value="Login" id=submit1 name=submit1></td>
<td><INPUT type="reset" value="Reset" id=reset1 name=reset1></td> 
</tr>
</table>
</form> 
<% 
if (not strADsPath= "") then 
 strADsPath = "WinNT://" & strADsPath 
 Dim oADsObject  
 Dim tempstr 
  tempstr = strDomain & "\" & strUserName 


  Set oADsObject = GetObject(strADsPath) 

  response.write "Authenticating<br>" 
  Dim strADsNamespace 
  Dim oADsNamespace 
  strADsNamespace = left(strADsPath, instr(strADsPath, ":")) 
  set oADsNamespace = GetObject(strADsNamespace) 

  Set oADsObject = oADsNamespace.OpenDSObject(strADsPath, tempstr, strPassword, 0) 

 if not (Err.number = 0) then 
  'Response.Write "Failed to bind to object <strong>" & strADsPath & "</strong><br>" 
  'response.write err.description & "<p>" 
  Response.write("Invalid Login") & "<p>"
  Response.write "Error number is " & err.number & "<br>" 
 else 
          Set cnn = Server.CreateObject("ADODB.Connection")
        cnn.Open ConnectString
         SQL = "Select Username, FullName From tbl_Users"
        Set RS = cnn.Execute(SQL) 
        Do Until rs.eof
            User = rs("Username")
             If  User = Request.Form("UserName") Then
                  Session("Authenticated") = "True"
                  'Get the fullname to put in the log file and also used in the updated by field throughout the site...session var
                  FullName = rs("FullName")
                  Session("Username") = FullName
                  'Write to the log.txt file to log the login!
                  CreateObject("Scripting.FileSystemObject").OpenTextFile("c:\log.txt", 8, True).Write (FullName) & " ~ " & (date()) & " ~ " & (time()) & vbCrLf
                  response.redirect("default.asp")
              Else
                'response.write(strUsername & "A")
                  response.write("   User has has Been Authenticated but has not got the appropiate permissions")
             End If
        rs.movenext
        Loop  
 end if 
 response.write "<p>" 
end if 
Set cnn = Nothing
Set rs = Nothing
set oADsNamespace = Nothing
Set oADsObject = Nothing
%> 
<p> 
</body> 
</html>
 
Old July 13th, 2004, 08:24 PM
Registered User
 
Join Date: Jul 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Your script doesn't help much. I still can't authenticate when i loop the script to 700users at the same time.
Do you have any other ways?

 
Old July 14th, 2004, 01:25 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to acdsky
Default

Hi There

What are u trying to do excactly? Could u give me more detail? Maybe u just facing a problem where u creating alot of objects and never killing them thus the webserver reach some limit/memory leak?

Marnus
 
Old July 14th, 2004, 03:17 AM
Registered User
 
Join Date: Jul 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have a student intranet ,so it involved of alot of students to login, especially on the release of results. Everytime when the result is out, the login page will crash. Here is my script. I did set the object to nothing but it didnt work.

<%
on error resume next
Dim strADsPath
strADsPath = "WinNT://mydomain"
Dim strUserName
strUserName = "mydomain\test"
Dim strPassword
strPassword = "test"
%>
<%
Dim oADsObject
Set oADsObject = GetObject(strADsPath)
Dim strADsNamespace
Dim oADsNamespace
dim i
        on error resume next
        for i = 1 to 1000
        strADsNamespace = left(strADsPath, instr(strADsPath, ":"))
        set oADsNamespace = GetObject(strADsNamespace)
        Set oADsObject = oADsNamespace.OpenDSObject(strADsPath, strUserName, strPassword, 0)
        oADsObject.GetInfo
    if not (Err.number = 0) then
    Response.Write "<bR> No. " & i & " Fail "</BR>"
    else
    Response.Write "<bR> No. " & i & " Pass "</BR>"
    end if
    Set oADsObject = Nothing
    set oADsNamespace = Nothing
    next
%>


 
Old July 14th, 2004, 04:26 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to acdsky
Default

Hi

Why are u using the for loop (for i = 1 to 1000)? With this loop you are binding to the GC 999 times everytime a user logs in? Let me know if Im missing something here.

Regards
Marnus
 
Old July 14th, 2004, 04:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Why don't you use the Basic Authentication mode(win2000) or Challenge/Response(WinNT) settings from IIS for achieving that, rather than using ANONYMOUS logon. That should be a reliable one, when you say it is an intranet.

Check this post http://p2p.wrox.com/topic.asp?TOPIC_ID=15959

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old July 14th, 2004, 09:56 AM
Registered User
 
Join Date: Jul 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

To acdsky:
I make it loop to 1000 is because i'm trying to simulate it to 1000 users. The same thing happen, the connection with AD were lost.

To happygv:
My intranet also able to access from internet too. Will the Basic Authentication mode works? I though only when the user login from the local network only able to retrieve this value (Request.ServerVariables("LOGON_USER")). How about if I access from internet? Will I get the ServerVariables too?

 
Old July 14th, 2004, 10:47 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Sorry if thats to be accessed from Internet, the I don't think this would help you out. I didn't know that it is also to be accessed from Internet.

Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old July 14th, 2004, 01:18 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I don't agree that the loop is simulating 1000 users. Right now, you just have one page in one process that does an awful lot of work.

In a real world, things will work differently; These 1000 users don't hit on the exact same moment, they'll be served by different threads, they are at a different place in the application etc etc.

I don't think this is a fair test; try a Web Stress tool like WAST for example for a more realistic test.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Circle by Slipknot (Track 6 from the album: Vol. 3: (The Subliminal Verses)) What's This?





Similar Threads
Thread Thread Starter Forum Replies Last Post
winnt.h iceman90289 Visual C++ 2005 2 May 12th, 2008 11:43 PM
ldap winnt authetication user sal21 Classic ASP Basics 9 February 13th, 2008 07:35 PM
Access Problem From Upgrade WinNt -> 2003 BrianWren Internet Information Services 0 March 22nd, 2007 11:39 AM
Access Problem From Upgrade WinNt -> 2003 BrianWren Windows Server 0 March 22nd, 2007 11:35 AM
database/.net comparison for winnt server qwjunk General .NET 0 August 8th, 2004 05:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.