zoukankan      html  css  js  c++  java
  • 用vb6写asp组件的简单例子

    本机调试
    1、重新启动www服务
    2、重新生成dll

    服务器注册
    1、手工注册DLL ,非常遗憾要重新启动服务器
    regsvr32 RHasp.dll
    反注册
    regsvr32 /u RHasp.dll

    2、另外还有一个方法可以不重新启动服务器
    使用MTS(Microsoft Transaction Server)
    MTS是IIS 4新增特色,但是它提供了巨大的改进。MTS允许你指定只有有特权的用
    户才能够 访问组件,大大提高了网站服务器上的安全性设置。在MTS上注册组件的步骤如下:
    (1) 打开IIS管理控制台。
    (2) 展开transaction server,右键单击"pkgs installed"然后选择"new package"
    (3) 单击"create an empty package"
    (4) 给该包命名
    (5) 指定administrator帐号或则使用"interactive"(如果服务器经常是使用administrator 登陆的话)
    (6) 现在使用右键单击你刚建立的那个包下面展开后的"components"。选择 "new then component"
    (7) 选择 "install new component"
    (8) 找到你的.dll文件然后选择next到完成。

    要删除这个对象,只要选择它的图标,然后选择delete.

    参考例子
    <%
    ‘调用的时候 server.createobject("工程名.类名")
    set RHasp = server.CreateObject("RHasp.Functions")
    RHasp.PrintInfo()
    set RHasp = nothing
    %>
    '**********************************************
    Private myScriptingcontext As ScriptingContext
    Private myApplication As Application
    Private myRequest As Request
    Private myResponse As Response
    Private myServer As Server
    Private mySession As Session
    '**********************************************

    '*****************************************************************
    Public Sub OnStartPage(passedscriptingcontext As ScriptingContext)
     Set myScriptingcontext = passedscriptingcontext
     Set myApplication = myScriptingcontext.Application
     Set myRequest = myScriptingcontext.Request
     Set myResponse = myScriptingcontext.Response
     Set myServer = myScriptingcontext.Server
     Set mySession = myScriptingcontext.Session
    End Sub
    '*****************************************************************

    '*********************************
    Public Sub OnEndPage()
     Set myScriptingcontext = Nothing
     Set myApplication = Nothing
     Set myRequest = Nothing
     Set myResponse = Nothing
     Set myServer = Nothing
     Set mySession = Nothing
    End Sub
    '********************************

    Public Sub PrintInfo()
     myResponse.Write ("当前时间:" & Now())
    End Sub
  • 相关阅读:
    Kattis
    HDU
    回溯法理解
    算法第5章上机实践报告
    贪心算法理解
    [模板] Dijkstra(堆优化)算法求最短路 Apare_xzc
    【文件管理系统】 Apaer_xzc
    [CCF] 201403-2 窗口 Apare_xzc
    [CCF] 201412-2 Z字形扫描 Apare_xzc
    [CCF] 201503-5 最小花费 Apare_xzc
  • 原文地址:https://www.cnblogs.com/MaxIE/p/950713.html
Copyright © 2011-2022 走看看