国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

服務器之家:專注于服務器技術及軟件下載分享
分類導航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術|正則表達式|C/C++|IOS|C#|Swift|Android|VB|R語言|JavaScript|易語言|vb.net|

服務器之家 - 編程語言 - ASP教程 - asp下調試程序的debug類

asp下調試程序的debug類

2019-10-16 09:50asp代碼網 ASP教程

ASP中最頭疼的就是調試程序的時候不方便,我想可能很多朋友都會用這樣的方法response.write,然后輸出相關的語句來看看是否正確。前幾天寫了一個千行的頁面,里面大概有七八個SUB/FUNCTION,調試的時候用了有三十幾個response.writ

ASP中最頭疼的就是調試程序的時候不方便,我想可能很多朋友都會用這樣的方法“response.write”,然后輸出相關的語句來看看是否正確。前幾天寫了一個千行的頁面,里面大概有七八個SUB/FUNCTION,調試的時候用了有三十幾個response.write,天,調試完后把這三十個一個個刪除,累!

今天看到一個ASP中的Debug類(VBS),試用了一下,絕!

使用方法很簡單:

test.asp

  1. <!--#INCLUDE FILE="debuggingConsole.asp"-->  
  2. <%  
  3. output="XXXX"  
  4. Set debugstr = New debuggingConsole  
  5. debugstr.Enabled = true  
  6. debugstr.Print "參數output的值", output  
  7. ''……  
  8. debugstr.draw  
  9. Set debugstr = Nothing  
  10. %>  
  11.  
  12. ===================================================  
  13.  
  14. debuggingConsole.asp  
  15.  
  16. <%  
  17. Class debuggingConsole  
  18.  
  19. private dbg_Enabled  
  20. private dbg_Show  
  21. private dbg_RequestTime  
  22. private dbg_FinishTime  
  23. private dbg_Data  
  24. private dbg_DB_Data  
  25. private dbg_AllVars  
  26. private dbg_Show_default  
  27. private DivSets(2)  
  28.  
  29. ''Construktor => set the default values  
  30. Private Sub Class_Initialize()  
  31. dbg_RequestTime = Now()  
  32. dbg_AllVars = false  
  33. Set dbg_Data = Server.CreateObject("Scripting.Dictionary")  
  34. DivSets(0) = "<TR><TD style=''cursor:hand;'' onclick=""javascript:if (document.getElementById(''data#sectname#'').style.display==''none''){document.getElementById(''data#sectname#'').style.display=''block'';}else{document.getElementById(''data#sectname#'').style.display=''none'';}""><DIV id=sect#sectname# style=""font-weight:bold;cursor:hand;background:#7EA5D7;color:white;padding-left:4;padding-right:4;padding-bottom:2;"">|#title#| <DIV id=data#sectname# style=""cursor:text;display:none;background:#FFFFFF;padding-left:8;"" onclick=""window.event.cancelBubble = true;"">|#data#| </DIV>|</DIV>|"  
  35. DivSets(1) = "<TR><TD><DIV id=sect#sectname# style=""font-weight:bold;cursor:hand;background:#7EA5D7;color:white;padding-left:4;padding-right:4;padding-bottom:2;"" onclick=""javascript:if (document.getElementById(''data#sectname#'').style.display==''none''){document.getElementById(''data#sectname#'').style.display=''block'';}else{document.getElementById(''data#sectname#'').style.display=''none'';}"">|#title#| <DIV id=data#sectname# style=""cursor:text;display:block;background:#FFFFFF;padding-left:8;"" onclick=""window.event.cancelBubble = true;"">|#data#| </DIV>|</DIV>|"  
  36. DivSets(2) = "<TR><TD><DIV id=sect#sectname# style=""background:#7EA5D7;color:lightsteelblue;padding-left:4;padding-right:4;padding-bottom:2;"">|#title#| <DIV id=data#sectname# style=""display:none;background:lightsteelblue;padding-left:8"">|#data#| </DIV>|</DIV>|"  
  37. dbg_Show_default = "0,0,0,0,0,0,0,0,0,0,0"  
  38. End Sub  
  39.  
  40. Public Property Let Enabled(bNewValue) ''''[bool] Sets "enabled" to true or false  
  41. dbg_Enabled = bNewValue  
  42. End Property  
  43. Public Property Get Enabled ''''[bool] Gets the "enabled" value  
  44. Enabled = dbg_Enabled  
  45. End Property  
  46.  
  47. Public Property Let Show(bNewValue) ''''[string] Sets the debugging panel. Where each digit in the string represents a debug information pane in order (11 of them). 1=open, 0=closed  
  48. dbg_Show = bNewValue  
  49. End Property  
  50. Public Property Get Show ''''[string] Gets the debugging panel.  
  51. Show = dbg_Show  
  52. End Property  
  53.  
  54. Public Property Let AllVars(bNewValue) ''''[bool] Sets wheather all variables will be displayed or not. true/false  
  55. dbg_AllVars = bNewValue  
  56. End Property  
  57. Public Property Get AllVars ''''[bool] Gets if all variables will be displayed.  
  58. AllVars = dbg_AllVars  
  59. End Property  
  60.  
  61. ''******************************************************************************************************************  
  62. ''''@SDESCRIPTION: Adds a variable to the debug-informations.  
  63. ''''@PARAM: - label [string]: Description of the variable  
  64. ''''@PARAM: - output [variable]: The variable itself  
  65. ''******************************************************************************************************************  
  66. Public Sub Print(label, output)  
  67. If dbg_Enabled Then  
  68. if err.number > 0 then  
  69. call dbg_Data.Add(ValidLabel(label), "!!! Error: " & err.number & " " & err.Description)  
  70. err.Clear  
  71. else  
  72. uniqueID = ValidLabel(label)  
  73. response.write uniqueID  
  74. call dbg_Data.Add(uniqueID, output)  
  75. end if  
  76. End If  
  77. End Sub  
  78.  
  79. ''******************************************************************************************************************  
  80. ''* ValidLabel  
  81. ''******************************************************************************************************************  
  82. Private Function ValidLabel(byval label)  
  83. dim i, lbl  
  84. i = 0  
  85. lbl = label  
  86. do  
  87. if not dbg_Data.Exists(lbl) then exit do  
  88. i = i + 1  
  89. lbl = label & "(" & i & ")"  
  90. loop until i = i  
  91.  
  92. ValidLabel = lbl  
  93. End Function  
  94.  
  95. ''******************************************************************************************************************  
  96. ''* PrintCookiesInfo  
  97. ''******************************************************************************************************************  
  98. Private Sub PrintCookiesInfo(byval DivSetNo)  
  99. dim tbl, cookie, key, tmp  
  100. For Each cookie in Request.Cookies  
  101. If Not Request.Cookies(cookie).HasKeys Then  
  102. tbl = AddRow(tbl, cookie, Request.Cookies(cookie))   
  103. Else  
  104. For Each key in Request.Cookies(cookie)  
  105. tbl = AddRow(tbl, cookie & "(" & key & ")", Request.Cookies(cookie)(key))   
  106. Next  
  107. End If  
  108. Next  
  109.  
  110. tbl = MakeTable(tbl)  
  111. if Request.Cookies.count <= 0 then DivSetNo = 2  
  112. tmp = replace(replace(replace(DivSets(DivSetNo),"#sectname#","COOKIES"),"#title#","COOKIES"),"#data#",tbl)  
  113. Response.Write replace(tmp,"|", vbcrlf)  
  114. end sub  
  115.  
  116. ''******************************************************************************************************************  
  117. ''* PrintSuMMaryInfo  
  118. ''******************************************************************************************************************  
  119. Private Sub PrintSummaryInfo(byval DivSetNo)  
  120. dim tmp, tbl  
  121. tbl = AddRow(tbl, "Time of Request",dbg_RequestTime)  
  122. tbl = AddRow(tbl, "Elapsed Time",DateDiff("s", dbg_RequestTime, dbg_FinishTime) & " seconds")  
  123. tbl = AddRow(tbl, "Request Type",Request.ServerVariables("REQUEST_METHOD"))  
  124. tbl = AddRow(tbl, "Status Code",Response.Status)  
  125. tbl = AddRow(tbl, "Script Engine",ScriptEngine & " " & ScriptEngineMajorVersion & "." & ScriptEngineMinorVersion & "." & ScriptEngineBuildVersion)  
  126. tbl = MakeTable(tbl)  
  127. tmp = replace(replace(replace(DivSets(DivSetNo),"#sectname#","SUMMARY"),"#title#","SUMMARY INFO"),"#data#",tbl)  
  128. Response.Write replace(tmp,"|", vbcrlf)  
  129. End Sub  
  130.  
  131. ''******************************************************************************************************************  
  132. ''''@SDESCRIPTION: Adds the Database-connection object to the debug-instance. To display Database-information  
  133. ''''@PARAM: - oSQLDB [object]: connection-object  
  134. ''******************************************************************************************************************  
  135. Public Sub GrabDatabaseInfo(byval oSQLDB)  
  136. dbg_DB_Data = AddRow(dbg_DB_Data, "ADO Ver",oSQLDB.Version)  
  137. dbg_DB_Data = AddRow(dbg_DB_Data, "OLEDB Ver",oSQLDB.Properties("OLE DB Version"))  
  138. dbg_DB_Data = AddRow(dbg_DB_Data, "DBMS",oSQLDB.Properties("DBMS Name") & " Ver: " & oSQLDB.Properties("DBMS Version"))  
  139. dbg_DB_Data = AddRow(dbg_DB_Data, "Provider",oSQLDB.Properties("Provider Name") & " Ver: " & oSQLDB.Properties("Provider Version"))  
  140. End Sub  
  141.  
  142. ''******************************************************************************************************************  
  143. ''* PrintDatabaseInfo  
  144. ''******************************************************************************************************************  
  145. Private Sub PrintDatabaseInfo(byval DivSetNo)  
  146. dim tbl  
  147. tbl = MakeTable(dbg_DB_Data)  
  148. tbl = replace(replace(replace(DivSets(DivSetNo),"#sectname#","DATABASE"),"#title#","DATABASE INFO"),"#data#",tbl)  
  149. Response.Write replace(tbl,"|", vbcrlf)  
  150. End Sub  
  151.  
  152. ''******************************************************************************************************************  
  153. ''* PrintCollection  
  154. ''******************************************************************************************************************  
  155. Private Sub PrintCollection(Byval Name, ByVal Collection, ByVal DivSetNo, ByVal ExtraInfo)  
  156. Dim vItem, tbl, Temp  
  157. For Each vItem In Collection  
  158. if isobject(Collection(vItem)) and Name <> "SERVER VARIABLES" and Name <> "QUERYSTRING" and Name <> "FORM" then  
  159. tbl = AddRow(tbl, vItem, "{object}")  
  160. elseif isnull(Collection(vItem)) then  
  161. tbl = AddRow(tbl, vItem, "{null}")  
  162. elseif isarray(Collection(vItem)) then  
  163. tbl = AddRow(tbl, vItem, "{array}")  
  164. else  
  165. if dbg_AllVars then  
  166. tbl = AddRow(tbl, "<nobr>" & vItem & "</nobr>", server.HTMLEncode(Collection(vItem)))  
  167. elseif (Name = "SERVER VARIABLES" and vItem <> "ALL_HTTP" and vItem <> "ALL_RAW") or Name <> "SERVER VARIABLES" then  
  168. if Collection(vItem) <> "" then  
  169. tbl = AddRow(tbl, vItem, server.HTMLEncode(Collection(vItem))) '' & " {" & TypeName(Collection(vItem)) & "}")  
  170. else  
  171. tbl = AddRow(tbl, vItem, "...")  
  172. end if  
  173. end if  
  174. end if  
  175. Next  
  176. if ExtraInfo <> "" then tbl = tbl & "<TR><TD COLSPAN=2><HR></TR>" & ExtraInfo  
  177. tbl = MakeTable(tbl)  
  178. if Collection.count <= 0 then DivSetNo =2  
  179. tbl = replace(replace(DivSets(DivSetNo),"#title#",Name),"#data#",tbl)  
  180. tbl = replace(tbl,"#sectname#",replace(Name," ",""))  
  181. Response.Write replace(tbl,"|", vbcrlf)  
  182. End Sub  
  183.  
  184. ''******************************************************************************************************************  
  185. ''* AddRow  
  186. ''******************************************************************************************************************  
  187. Private Function AddRow(byval t, byval var, byval val)  
  188. t = t & "|<TR valign=top>|<TD>|" & var & "|<TD>= " & val & "|</TR>"  
  189. AddRow = t  
  190. End Function  
  191.  
  192. ''******************************************************************************************************************  
  193. ''* MakeTable  
  194. ''******************************************************************************************************************  
  195. Private Function MakeTable(byval tdata)  
  196. tdata = "|<table border=0 style=""font-size:10pt;font-weight:normal;"">" + tdata + "</Table>|"  
  197. MakeTable = tdata  
  198. End Function  
  199.  
  200. ''******************************************************************************************************************  
  201. ''''@SDESCRIPTION: Draws the Debug-panel  
  202. ''******************************************************************************************************************  
  203. Public Sub draw()  
  204. If dbg_Enabled Then  
  205. dbg_FinishTime = Now()  
  206.  
  207. Dim DivSet, x  
  208. DivSet = split(dbg_Show_default,",")  
  209. dbg_Show = split(dbg_Show,",")  
  210.  
  211. For x = 0 to ubound(dbg_Show)  
  212. divSet(x) = dbg_Show(x)  
  213. Next  
  214.  
  215. Response.Write "<BR><Table width=100% cellspacing=0 border=0 style=""font-family:arial;font-size:9pt;font-weight:normal;""><TR><TD><DIV style=""background:#005A9E;color:white;padding:4;font-size:12pt;font-weight:bold;"">Debugging-console:</DIV>"  
  216. Call PrintSummaryInfo(divSet(0))  
  217. Call PrintCollection("VARIABLES", dbg_Data,divSet(1),"")  
  218. Call PrintCollection("QUERYSTRING", Request.QueryString(), divSet(2),"")  
  219. Call PrintCollection("FORM", Request.Form(),divSet(3),"")  
  220. Call PrintCookiesInfo(divSet(4))  
  221. Call PrintCollection("SESSION", Session.Contents(),divSet(5),AddRow(AddRow(AddRow("","Locale ID",Session.LCID & " (&H" & Hex(Session.LCID) & ")"),"Code Page",Session.CodePage),"Session ID",Session.SessionID))  
  222. Call PrintCollection("APPLICATION", Application.Contents(),divSet(6),"")  
  223. Call PrintCollection("SERVER VARIABLES", Request.ServerVariables(),divSet(7),AddRow("","Timeout",Server.ScriptTimeout))  
  224. Call PrintDatabaseInfo(divSet(8))  
  225. Call PrintCollection("SESSION STATIC OBJECTS", Session.StaticObjects(),divSet(9),"")  
  226. Call PrintCollection("APPLICATION STATIC OBJECTS", Application.StaticObjects(),divSet(10),"")  
  227. Response.Write "</Table>"  
  228. End If  
  229. End Sub  
  230.  
  231. ''Destructor  
  232. Private Sub Class_Terminate()  
  233. Set dbg_Data = Nothing  
  234. End Sub  
  235.  
  236. End Class  
  237.  
  238. %>  

類的說明:

CLASSdebuggingConsole

Version:1.2

PublicProperties

PropertyLetEnabled(bNewValue)[bool]Sets"enabled"totrueorfalse

PropertyGetEnabled[bool]Getsthe"enabled"value

PropertyLetShow(bNewValue)[string]Setsthedebuggingpanel.Whereeachdigitinthestringrepresentsadebuginformationpaneinorder(11ofthem).1=open,0=closed

PropertyGetShow[string]Getsthedebuggingpanel.

PropertyLetAllVars(bNewValue)[bool]Setswheatherallvariableswillbedisplayedornot.true/false

PropertyGetAllVars[bool]Getsifallvariableswillbedisplayed.

PublicMethods

publicsubPrint(label,output)

Addsavariabletothedebug-informations.

publicsubGrabDatabaseInfo(byvaloSQLDB)

AddstheDatabase-connectionobjecttothedebug-instance.TodisplayDatabase-information

publicsubdraw()

DrawstheDebug-panel

MethodsDetail

publicsubPrint(label,output)

Parameters:-label[string]:Descriptionofthevariable

-output[variable]:Thevariableitself

publicsubGrabDatabaseInfo(byvaloSQLDB)

Parameters:-oSQLDB[object]:connection-object

延伸 · 閱讀

精彩推薦
Weibo Article 1 Weibo Article 2 Weibo Article 3 Weibo Article 4 Weibo Article 5 Weibo Article 6 Weibo Article 7 Weibo Article 8 Weibo Article 9 Weibo Article 10 Weibo Article 11 Weibo Article 12 Weibo Article 13 Weibo Article 14 Weibo Article 15 Weibo Article 16 Weibo Article 17 Weibo Article 18 Weibo Article 19 Weibo Article 20 Weibo Article 21 Weibo Article 22 Weibo Article 23 Weibo Article 24 Weibo Article 25 Weibo Article 26 Weibo Article 27 Weibo Article 28 Weibo Article 29 Weibo Article 30 Weibo Article 31 Weibo Article 32 Weibo Article 33 Weibo Article 34 Weibo Article 35 Weibo Article 36 Weibo Article 37 Weibo Article 38 Weibo Article 39 Weibo Article 40
主站蜘蛛池模板: 精品日韩一区二区 | av一级毛片 | 亚洲精品天堂 | 综合精品| 国产成人精品一区二区三区视频 | 久久久一 | 国产综合精品一区二区三区 | 成人免费一区二区三区视频网站 | av免费观看网站 | 在线一区观看 | 国产成人久久 | 99色综合| 精品国产黄a∨片高清在线 欧美一级免费 | 精品国产欧美一区二区三区成人 | 国产精品久久久久久久久 | 激情国产| 久久久久国产一区二区三区 | 一本色道久久综合狠狠躁篇怎么玩 | 久久精品国产一区二区电影 | 玖玖精品在线 | 精品视频一区二区三区在线观看 | 亚洲天堂久久 | 在线观看国产精品一区 | 北条麻妃在线一区二区免费播放 | 91麻豆精品国产91久久久资源速度 | jlzzjlzz亚洲日本少妇 | 久久久久一区二区 | 99精品视频一区二区三区 | 欧美国产精品一区 | 中文av一区 | 亚洲精品1 | 色综合社区 | 自拍偷拍精品 | 国产伦精品一区二区三区四区视频 | 久久国产免费 | 秋霞特色aa大片 | 国产精品中文字幕在线观看 | 一区二区三区视频 | www久久精品 | 久久精品亚洲精品国产欧美 | 亚洲国产成人在线 |