Classic ASP에서 Session 변수에 문제가 있습니다. 다음 코드의 라인 (19)에 , 나는 "유형 불일치 : 'i'를"지고있어 오류Classic ASP Type 불일치
- debug.asp이 session.asp에 포함 된 모듈 내 프로그램의 다른 모듈
-
<% '---------------------------------------------------------------------------- ' File: /include/script/debug.asp ' Author: Vladimir Charkot ' Create Date: 15/05/2013 ' Description: Generate a server debug log on client '---------------------------------------------------------------------------- Redim debugTable(2,0) Sub initDebug(debugLevel) Session("debugEntries") = 0 Session("debugLevel") = "e" Call debugMsg("e","Debug initialized") End Sub Sub debugMsg(lv, str) If IsEmpty(Session("debugEntries")) Then i = 0 Else i = Session("debugEntries") <-- Line 21, Type mismatch error IF CInt() IS APPLIED TO SESSION VARIABLE End If i = i + 1 <-- Line 23, Type mismatch error Redim Preserve debugTable(2,i) debugTable(0,i-1) = lv debugTable(1,i-1) = str Session("debugEntries") = CInt(i) End Sub Function debugToClient() Dim list Dim func list = jsDebugList() func = jsDebugFunction(list) debugToClient = func End Function Function jsDebugList() Dim i Dim list If IsEmpty(Session("debugEntries")) Then i = 0 Else i = Session("debugEntries") End If list = "[" for n = 0 to i - 2 'Add the last one outside the loop list = list & "{debugLevel : """ & debugTable(0,n) & """, message : """ & debugTable(1,n) & """}, " ' i.e.: {debugLevel : "e", message : "Error on application"}, next list = list & "{debugLevel : """ & debugTable(0,n) & """, message : """ & debugTable(1,n) & """}" list = list & "]" jsDebugList = list End Function Function jsDebugFunction(l) Dim f f = "function debug(){" f = f & " debugList = " & l & ";" f = f & " for (elem in debugList){" f = f & " console.log(elem.debugLevel + "": "" + elem.message);" f = f & " }" f = f & "}" jsDebugFunction = f End Function %>
<!-- #include virtual="/gu/include/script/debug.asp" --> sub InitSession() (...stuff...) Call initDebug("e") end sub sub CheckSession() ' If not a new session, this code has already been executed. if stuff then timeout() end if Call debugMsg("e", "CheckSession() Executed") end sub
- 마지막으로 515,는 session.asp은 내 페이지 파일, 내 브라우저에서 열기를 호출하고 형식 불일치 오류를 반환하는 하나에 포함되어 있습니다.
당신이 나를 도울 수 있기를 바랍니다. 나는 이미 모든 것을 시도했다고 생각합니다. 부두교를 제외하고, 흑 마법과 그 종류. 감사합니다.
라인 (17)에 세션의 값 ("debugEntries")는 무엇입니까? 18 행이 호출되기 전에 Response.Write를 수행하고 값을 확인할 수 있습니까? – Csharp
시도해 보겠습니다. 그것은 처음으로 호출 할 때 0이어야합니다. 그러나 검사 할 것입니다. 좋은 제안. – Vladimir