欢迎您访问我爱IT技术网,今天小编为你分享的编程技术是:【ASP中的Debug类--VBScript】,下面是详细的分享!
ASP中的Debug类--VBScript
test.ASP
<!--#INCLUDE FILE="debuggingConsole.ASP"-->
<%
output="XXXX"
Set debugstr=New debuggingConsole
debugstr.Enabled=true
debugstr.Print "参数output的值", output
'……
debugstr.draw
Set debugstr=Nothing
%>
===================================================
debuggingConsole.ASP
<%
Class debuggingConsole
private dbg_Enabled
private dbg_Show
private dbg_RequestTime
private dbg_FinishTime
private dbg_Data
private dbg_DB_Data
private dbg_AllVars
private dbg_Show_default
private DivSets(2)
'Construktor=> set the default values
Private Sub Class_Initialize()
dbg_RequestTime=Now()
dbg_AllVars=false
Set dbg_Data=Server.CreateObject("Scripting.Dictionary")
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>|"
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>|"
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>|"
dbg_Show_default="0,0,0,0,0,0,0,0,0,0,0"
End Sub
Public Property Let Enabled(bNewValue) ''[bool] Sets "enabled" to true or false
dbg_Enabled=bNewValue
End Property
Public Property Get Enabled ''[bool] Gets the "enabled" value
Enabled=dbg_Enabled
End Property
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
dbg_Show=bNewValue
End Property
Public Property Get Show ''[string] Gets the debugging panel.
Show=dbg_Show
End Property
Public Property Let AllVars(bNewValue) ''[bool] Sets wheather all variables will be displayed or not. true/false
dbg_AllVars=bNewValue
End Property
Public Property Get AllVars ''[bool] Gets if all variables will be displayed.
AllVars=dbg_AllVars
End Property
'******************************************************************************************************************
''@SDESCRIPTION: Adds a variable to the debug-informations.
''@PARAM: - label [string]: Description of the variable
''@PARAM: - output [variable]: The variable itself
'******************************************************************************************************************
Public Sub Print(label, output)
If dbg_Enabled Then
if err.number > 0 then
call dbg_Data.Add(ValidLabel(label), "!!! Error: " & err.number & " " & err.Description)
err.Clear
else
uniqueID=ValidLabel(label)
response.write uniqueID
call dbg_Data.Add(uniqueID, output)
end if
End If
End Sub
'******************************************************************************************************************
'* ValidLabel
'******************************************************************************************************************
Private Function ValidLabel(byval label)
dim i, lbl
i=0
lbl=label
do
if not dbg_Data.Exists(lbl) then exit do
i=i + 1
lbl=label & "(" & i & ")"
loop until i=i
ValidLabel=lbl
End Function
'******************************************************************************************************************
'* PrintCookiesInfo
'******************************************************************************************************************
Private Sub PrintCookiesInfo(byval DivSetNo)
dim tbl, cookie, key, tmp
For Each cookie in Request.Cookies
If Not Request.Cookies(cookie).HasKeys Then
tbl=AddRow(tbl, cookie, Request.Cookies(cookie))
Else
For Each key in Request.Cookies(cookie)
tbl=AddRow(tbl, cookie & "(" & key & ")", Request.Cookies(cookie)(key))
Next
End If
Next
tbl=MakeTable(tbl)
if Request.Cookies.count <=0 then DivSetNo=2
tmp=replace(replace(replace(DivSets(DivSetNo),"#sectname#","COOKIES"),"#title#","COOKIES"),"#data#",tbl)
Response.Write replace(tmp,"|", vbcrlf)
end sub
'******************************************************************************************************************
'* PrintSummaryInfo
'******************************************************************************************************************
Private Sub PrintSummaryInfo(byval DivSetNo)
dim tmp, tbl
tbl=AddRow(tbl, "Time of Request",dbg_RequestTime)
tbl=AddRow(tbl, "Elapsed Time",DateDiff("s", dbg_RequestTime, dbg_FinishTime) & " seconds")
tbl=AddRow(tbl, "Request Type",Request.ServerVariables("REQUEST_METHOD"))
tbl=AddRow(tbl, "Status Code",Response.Status)
tbl=AddRow(tbl, "Script Engine",ScriptEngine & " " & ScriptEngineMajorVersion & "." & ScriptEngineMinorVersion & "." & ScriptEngineBuildVersion)
tbl=MakeTable(tbl)
tmp=replace(replace(replace(DivSets(DivSetNo),"#sectname#","SUMMARY"),"#title#",&quo
以上所分享的是关于ASP中的Debug类--VBScript,下面是编辑为你推荐的有价值的用户互动:
相关问题:如何:使用类库中定义的模型
答:-或 -在解决方案资源管理器中右键单击类库项目,然后选择“生成”。类库程序集即添加到项目的 bin\Debug 文件夹。右键单击 ASP.NET 网站项目并选择“添加 ASP.NET... >>详细
相关问题:ASP是什么?和VBScript,JavaScript什么关系
答:ASP是动态服务器页面(Active Server Page)的英文缩写。是微软公司开发的代替CGI脚本程序的一种应用,它可以与数据库和其它程序进行交互,是一种简单、方便的编程工具。ASP的网页文件的格式是 .asp。现在常用于各种动态网站中。 VBScript是Visu... >>详细
相关问题:脚本分几种,用途都是什么?
答:例如在脚本中加入一些破坏计算机系统的命令,这样当用户浏览网页时,一旦调用 这类...常见的脚本语言:Scala、JavaScript,VBScript,ActionScript,MAX Script,ASP,JSP,PHP... >>详细
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
