Argument 'Start' must be greater than zero

Jan 26, 2010 at 8:34 AM

My app runs and hits my login page, but then I get an error - "Argument 'Start' must be greater than zero". I would love to get this working for our project, so please help. Here's the code.

<%@ Language=VBScript %>

<%Option Explicit

 

Dim objUser, objTools, objRS

Dim lUsrNum

Dim sPWD, sMessage, sSQL

Dim dPwdExpires

 

lUsrNum = Request.Form("usrnum")

sPWD = Request.Form("pwd")

 

set objUser = Server.CreateObject("CrimeNtel_BO.clsUser")

If objUser.LoginSuccess(lUsrNum, sPWD) = True Then

Set objTools = Server.CreateObject("CrimeNtel_BO.clsTools")

objTools.DatabaseName = "CATALOG"

sSQL = "SELECT ALT_FILE_PATH, AGENCY FROM SETUP"

Set objRS = objTools.OpenRS(sSQL)

If objRS.RecordCount = 1 Then

If Not IsNull(objRS.Fields("ALT_FILE_PATH").Value) Then

Response.Cookies("Alt_File_Path") = objRS.Fields("ALT_FILE_PATH").Value

End If

If Not IsNull(objRS.Fields("AGENCY").Value) Then

Response.Cookies("Agency") = objRS.Fields("AGENCY").Value

End If

End If

objRS.Close

sSQL = "SELECT AGTNUM, P_WORD_EXPIRES FROM USERS WHERE USRNUM = " & lUsrNum

Set objRS = objTools.OpenRS(sSQL)

If IsNull(objRS.Fields("AGTNUM").Value) Then

Response.Cookies("AGTNUM") = 0

Else

Response.Cookies("AGTNUM") = objRS.Fields("AGTNUM").Value

End If

 

If IsNull(objRS.Fields("P_WORD_EXPIRES").Value) Then

dPwdExpires = Now - 1

Else

dPwdExpires = CDate(objRS.Fields("P_WORD_EXPIRES").Value)

End If

 

Response.Cookies("ImageDriveLetter") = objTools.ImageDriveLetter

Response.Cookies("UsrNum") = lUsrNum

Response.Cookies("LoggedIn") = "True"

 

Dim appPath

appPath = Replace(Server.MapPath("."), "\", "/")

appPath = Right(appPath, (Len(appPath) - InstrRev(appPath, "/")) + 1)

Response.Cookies("AppPath") = appPath

 

objRS.Close

Set objTools = Nothing

Set objUser = Nothing

Set objRS = Nothing

 

If dPwdExpires < Now Then

Response.Redirect "passwordexpired.asp"

Else

Response.Redirect "databaseselect.asp"

End If

Else

sMessage = server.URLEncode("Invalid User name/Password combination")

Response.Cookies("LoggedIn") = "False"

Set objUser = Nothing

Response.Redirect "login.asp?message=" & sMessage

End If

 

%>

 

Jan 26, 2010 at 8:36 AM

Here's the exception message from the browser...

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: Argument 'Start' must be greater than zero.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace: 

[ArgumentException: Argument 'Start' must be greater than zero.]
   Dlrsoft.Asp.AspHandler.ProcessRequest(HttpContext context) +820
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
Jan 26, 2010 at 8:52 AM
Edited Jan 26, 2010 at 9:06 AM

After some Response.Write debugging (ah, those were the days...) the error is on this line...

appPath = Replace(Server.MapPath("."), "\", "/")

There are "optional" parameters for "start" that occur after the above parameters. Even though the "start" parameter is optional, it seems that when running under the "ASP Compiler" it is not. If I hand a non-zero parameter, it works.

Same thing happens for the method InstrRev...it's looking for a "start" parameter even though it's optional.

Further down in the code I'm comparing dates...

If dPwdExpires < Now Then

causes an error...

Operation LessThan between DateTime and DateTime is not implemeted.

This is an awesome project, but on page 2 of my huge app, these are the issues I've already encountered. Hopeful this progresses, but I can't proceed at this point. I can help and would love to if possible.

Coordinator
Jan 27, 2010 at 6:27 AM

Thanks for spotting the bug. I have fixed the bug in the changeset 38072.