惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
Netflix TechBlog - Medium
V
Vulnerabilities – Threatpost
Google Online Security Blog
Google Online Security Blog
Hugging Face - Blog
Hugging Face - Blog
L
LINUX DO - 热门话题
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
D
Docker
C
Cyber Attacks, Cyber Crime and Cyber Security
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
T
Tenable Blog
P
Privacy International News Feed
Google DeepMind News
Google DeepMind News
小众软件
小众软件
Cisco Talos Blog
Cisco Talos Blog
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
A
Arctic Wolf
C
Cybersecurity and Infrastructure Security Agency CISA
C
Cisco Blogs
T
Threat Research - Cisco Blogs
NISL@THU
NISL@THU
The Hacker News
The Hacker News
Project Zero
Project Zero
AWS News Blog
AWS News Blog
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Threatpost
V
Visual Studio Blog
The GitHub Blog
The GitHub Blog
The Cloudflare Blog
Last Week in AI
Last Week in AI
Jina AI
Jina AI
Cyberwarzone
Cyberwarzone
The Register - Security
The Register - Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
Vercel News
Vercel News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
MongoDB | Blog
MongoDB | Blog
U
Unit 42
Scott Helme
Scott Helme
A
About on SuperTechFans
WordPress大学
WordPress大学
F
Fortinet All Blogs
大猫的无限游戏
大猫的无限游戏
G
GRAHAM CLULEY
Latest news
Latest news
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
Schneier on Security

博客园 - Sady

Start my new level SCM Chart How to read the contents of a remote web page rs.open syntax Deal with replacing a string in an NTEXT field Get random records How to debug a vb dll for asp SQL Value Example ASP Class javascript injection attack - Sady Version 3 of OA System The relation chart of Supply Chain Management Version 2 of our oa system Supply Chain Management on Website Away for so long Self-promotion CSharp中几个关键概念 类的继承 DTD
封装ASP
Sady · 2009-03-19 · via 博客园 - Sady

1、打开Microsoft Visual Basic:

2、修改工程名和类模块的名称:

3、增加到引用asp:工程-->引用

4、编写代码:
在web.cls中输入
'#####################
Option Explicit

Private myContext As ScriptingContext
Private myApplication As Application
Private myResponse As Response
Private myRequest As Request
Private mySession As Session
Private myServer As Server

Public Sub OnStartPage(PassedScriptContext As ScriptingContext)
  Set myContext = PassedScriptContext
  Set myApplication = myContext.Application
  Set myResponse = myContext.Response
  Set myRequest = myContext.Request 
  Set mySession = myContext.Session
  Set myServer = myContext.Server
End Sub

'#########################
在VB中可以像在ASP中实现方法一样,如:
strName=myRequest.Form("name")
myResponse.Write ("Welcome! "&strName)
'######################### 

Public Sub Fun1()
  myResponse.Write "Fun1"
End Sub

Public Sub Fun2(para1 AS String)
  myResponse.Write para1&"<br />Fun2"
End Sub

Public Sub OnEndPage()
  Set myContext = Nothing
  Set myApplication = Nothing
  Set myResponse = Nothing
  Set myRequest = Nothing
  Set mySession = Nothing
  Set myServer = Nothing
End Sub

保存在d:\web\dll\web.cls
在把工程保存为d:\web\dll\sample.vbp

5、编译,注册成dll:

6、使用sample.dll:
在ASP中调用组建:
Set objRefer = Server.CreateObject("ProjectName.ClassName")

例如:
Set dll= Server.CreateObject("sample.web")
dll.Fun1
Response.Write "<hr />"
dll.Fun2("This is ")
Response.Write "<hr />"
Set dll = Nothing