Public Sub I_init()'Initialization Code, capture current browser action session state
    On Error Resume Next 'Handle missing session object due to @ directive
    Set ASPsc = GetObjectContext
    Set Server = ASPsc.Item("Server")
    Set Application = ASPsc.Item("Application")
    Set Session = ASPsc.Item("Session")
    Set Request = ASPsc.Item("Request")
    Set Response = ASPsc.Item("Response")
On Error GoTo errhandler
'app.LogEvent "a2dindex.I_init", vbLogEventTypeInformation  'uncomment for procedure trace log.a2dceshiI_init ' ASP2DLL included file : C:\1\ceshi.asp
6     sql = "select * from news where id=1"
7     Set rs = conn.execute(sql)
8     Response.write rs("标题")
9     Response.write ""
'ASPsc.setcomplete 'Uncomment for MTS transaction completion reporting
Exit Sub 'ASP2DLL Error Handling
errhandler: 'ASP2DLL Error Handling
If Err = -19691969 Then Exit Sub   '这里更改为 If Err = -19691969 Then Err.Raise -19691969 则提示错误
'Replace the below with your own custom error handler
App.LogEvent Err & " " & Error & " LINE #" & Erl & " Routine : a2dindex.I_init", vbLogEventTypeError
Response.write " Error " & Error & " LINE" & Erl & " Routine : a2dindex.I_init"
'The following is for complete MTS logging
'     app.logEvent Hex(App.ThreadID) & " Transactional: " & ASPSC.IsInTransaction
'     app.logevent Hex(App.ThreadID) & " DirectCaller: " & ASPSC.Security.GetDirectCallerName
'     app.logevent Hex(App.ThreadID) & " OriginalCaller: " & ASPSC.Security.GetOriginalCallerName
'ASPsc.setabort 'Uncomment for MTS transaction error reporting
'set ASPsc=NothingEnd Sub ' I_init
Public Sub a2dceshiI_init()On Error GoTo errhandler
'app.LogEvent "a2dindex.a2dceshiI_init", vbLogEventTypeInformation  'uncomment for procedure trace log.1     Set conn = CreateObject("ADODB.Connection")
2     Set rs = CreateObject("ADODB.Recordset")
3     Strconn = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("123.asp")
4     conn.Open Strconn
5     Err.Raise -19691969
'ASPsc.setcomplete 'Uncomment for MTS transaction completion reporting
Exit Sub 'ASP2DLL Error Handling
errhandler: 'ASP2DLL Error Handling
If Err = -19691969 Then Exit Sub   '这里需要更改为 If Err = -19691969 Then Err.Raise -19691969 才能终止输出 
'Replace the below with your own custom error handler
App.LogEvent Err & " " & Error & " LINE #" & Erl & " Routine : a2dindex.a2dceshiI_init", vbLogEventTypeError
Response.write " Error " & Error & " LINE" & Erl & " Routine : a2dindex.a2dceshiI_init"
'The following is for complete MTS logging
'     app.logEvent Hex(App.ThreadID) & " Transactional: " & ASPSC.IsInTransaction
'     app.logevent Hex(App.ThreadID) & " DirectCaller: " & ASPSC.Security.GetDirectCallerName
'     app.logevent Hex(App.ThreadID) & " OriginalCaller: " & ASPSC.Security.GetOriginalCallerName
'ASPsc.setabort 'Uncomment for MTS transaction error reporting
'set ASPsc=NothingEnd Sub ' a2dceshiI_init
上面代码是用来 判断asp转化后的 Response.End 如果我使用 If Err = -19691969 Then Exit Sub 则无法终止输出 因为我的 Response.End 语句是<!--#include file="ceshi.asp"-->得到的这个问题只有使用了<!--#include -->才会出现 如果同一个页面使用 Response.End 则没有问题 If Err = -19691969 Then Exit Sub 就可以终止输出了请问我上面的代码 If Err = -19691969 Then Exit Sub  怎么改才能终止输出  把代码中两个 If Err = -19691969 Then Exit Sub 更改为一致 需要怎么做? 现在上面的需要 If Err = -19691969 Then Exit Sub  下面的需要 If Err = -19691969 Then Err.Raise -19691969  才能有效 这个很麻烦 每个都要调试  请高手帮忙  分太少了 谢谢您 没有分了 

解决方案 »

  1.   

    如果同页 If Err = -19691969 Then Exit Sub 是可以终止的可是如果使用 include 加载过来的asp 中 使用了 Response.End  就无效了 
      

  2.   

    如果两个都是用 If Err = -19691969 Then Err.Raise -19691969会提示错误 zujian 错误 'fed3863f' Automation 错误 
      

  3.   

    Public Sub I_init()中没有 5     Err.Raise -19691969Public Sub a2dceshiI_init()中有 5     Err.Raise -19691969
      

  4.   

    干嘛非要这么封装
    把重要函数做成dll就可以了,加一个验证正版的程序,比这种方式实用,每次修改都要更新dll注册,然后还要重启iis,麻烦死……
      

  5.   

    那你就别include file了,用
    server.Transfer "你的文件.asp"
      

  6.   

    server.Transfer "你的文件.asp"  应该就是解呀顺便问一下,你怎么混到VB版来了?哈哈
      

  7.   

    我的意思是把<!--#include file=jtnwl.asp-->换成
    server.Transfer "jtnwl.asp"