Controlling Empty Arrays in Classic ASP

ginstt

New Member
OK I'm a complete newbie to ASP.I have a client with different content loading depending on what is passed in an array.select case lcase(arURL(4))Sometimes though, arURL(4) might be empty, in them cases I'm getting the following error:Error running function: functionName()There error was: Subscript out of rangeDoes anybody know a way to fix this?ThanksOK further code as requested. It is horrible code and I don't mean to cause anybody a headache, so please excuse it. Thanks again ........\[code\]function GetContent()dim strURL, arURL, strRetvalselect case lcase(request.ServerVariables("URL")) case "/content.asp" strURL = "" arURL = split(request.querystring("url"), "/") if request("page") = "" then select case lcase(arURL(2)) case "searches" select case lcase(arURL(1)) case "looking" select case lcase(arURL(3)) case "ohai" strRetval = "Lorem" case "blahblah" strRetval = "Lorem Ipsum" case "edinburgh" select case lcase(arURL(4)) case "ohai" strRetval = "Ipsum" case "ohno" strRetval = "Lorem" end select case "bristol" select case lcase(arURL(4)) case "some_blahblah" strRetval = "LOREM" case "overthere" strRetval = "LOREM" case "blahblah" strRetval = "LOREM" end select case "cambridge" select case lcase(arURL(4)) case "some_rubbish" strRetval = "Lorem" end select case else strRetval = " " end select case else strRetval = " " end select case else strRetval = " " end select end ifend select strRetval = strRetval & "<style>h2{border: 0px);</style>"GetContent = strRetval\[/code\]end function
 
Back
Top