logo

哈达波斯网|专注网站

ASP

ASP错误输出一些常用的方法等

ASP  2020/9/18 11:16:55  管理员  

调试输出错误方法什么的。

If Err.Number <> 0 then
call Err_Handler()
End If

Sub Err_Handler()
Response.write "<div style='color:red'>程式發生錯誤<br />"
Response.write "錯誤源碼 : " & Err.Source & "<br />"
Response.write "錯誤代號 : " & Err.Number & "<br />"
Response.write "錯誤訊息 : " & Err.Description & "</div>"
Response.End
End Sub

Function IIf( exp, rst1, rst2)
      If exp Then IIf = rst1 Else IIf = rst2
End Function

傳回 post 或 get 方法所收到的所有參數

Dim obj
for each obj in Request.Form
     response.write obj & "=" & Request.Form(obj) & "<br />"
next

Dim obj
for each obj in Request.QuerString
     response.write obj & "=" & Request.QuerString(obj) & "<br />"
next

太長的敘述要以 &_ 斷行

response.write "this is a" &_
"asp program test."

此範例為計算上線人數

Sub Application_OnStart
 Application("OnlineCount") = 0
End Sub
Sub Application_OnEnd
End Sub
Sub Session_OnStart
 Application.Lock
 Application("OnlineCount") = Application("OnlineCount") + 1
 Application.UnLock
End Sub
Sub Session_OnEnd
 Application.Lock
 Application("OnlineCount") = Application("OnlineCount") - 1
 Application.UnLock
End Sub


网站首页  | 最新公告  | 漏洞修补  | 网站模板  | 知识文档  | 与我联系
Copyright © 2015 jlasp.com All Rights Reserved.
哈达波斯网|专注网站 版权所有
地址:吉林省吉林市昌邑区 联系QQ:383612004 联系人:董先生
未经本站授权,禁止复制或建立镜像,内容仅用于学习参考!
ICP备案号:吉ICP备15000891号-1 | 

吉公网安备 22020202000301号