大家如果对ASP熟悉的话,就知道ASP最大的缺陷就是不能保证代码的安全性,如果源代码一旦泄露,后果将不堪设想。在这里呢,向大家推荐一个办法,就是用VB6.0将asp封装dll文件.dll文件是比较安全的,而且运行速度比asp快那么一点。具体步骤如下:
1、新建DLL
打开VB6-->文件-->新建工程-->选择ActiveX DLL-->打开
2、将默认工程、类重命名
点击工程——引用,然后选择其中的Microsoft Active Server Pages Object Library,还有引用Microsoft VBScript Regular Expressions 5.5(RegExp正则表达式对象)
4、编写代码
Option Explicit Private Context As ScriptingContext Private Application As Application Private Response As Response Private Request As Request Private Session As Session Private Server As Server Public Sub OnStartPage(PassedscriptContext As ScriptingContext) Set Context = PassedscriptContext Set Application = Context.Application Set Request = Context.Request Set Response = Context.Response Set Server = Context.Server Set Session = Context.Session End Sub Public Sub hello() Response.Write "欢迎访问金猫数据网络有限公司!" End Sub Public Sub OnEndPage() Set Application = Nothing Set Request = Nothing Set Response = Nothing Set Server = Nothing Set Session = Nothing Set Context = Nothing End Sub
7、注册dll
在yuzhiguo.dll组件所在目录创建“注册.bat”批处理文件,输入:
iisreset/stop regsvr32/s yuzhiguo.dll iisreset/start
“卸载.bat”批处理文件,输入:
iisreset/stop regsvr32 /u /s yuzhiguo.dll iisreset/start
双击运行注册.bat,成功注册会提示:“yuzhiguo.dll 中的 Dll Register Server 成功。”
8、asp中调用dll
新建test.asp文件,输入代码:
<%
Dim yuzhiguo
Set yuzhiguo=Server.CreateObject("yuzhiguo.demo")
yuzhiguo.hello()
%>
访问test.asp结果会输出:
欢迎访问金猫数据网络有限公司!
上一篇:企业网站需要多大的网站空间?
下一篇:网站改版前需要做哪些准备工作
版权所有 深圳市金猫数据网络有限公司 粤ICP备13059455号
公司地址:深圳市宝安区龙华民治街道嘉熙业广场1241
免费热线:4007-918-178 电 话:0755-83958156
公司邮箱:jm3q@jm3q.com 传 真:0755-83958156
Sitemap.xml 粤公网安备 44030902000741号