经过辛苦编写的代码大家都希望不会不经过允许就随便让人看到...NET就很方便了,可以把代码编译为DLL,PHP也有其独特的方式,那ASP该如何加密代码让其受保护呢?
我以前的方法是用MICROSOFT自带的Script Encoder,不过这个方法在某些特殊情况会出现错误!
就此方面,欢迎大家一起来研究讨论一下吧!
他骗人,无法下载!
我还是来看看我的总结想法吧!
下面是在网上看到的总结的大家可以看一下。
大家在写asp程序时,最担心的可能就是数据库的连接信息,会被一些人看到,进行一些破坏。下面我们用vb6.0来做一个动态链接库(.dll)来隐藏数据库的连接信息。
启动vb6.0,新建-->Active dll工程。单击"工程"-->引用,选择"microsoft active server pages object library"和"microsoft activeX data objects 2.1 library"两项。将类模块的名称改为dcss.将工程的名称改为yygwy.保存工程文件yygwy.vbp和类文件dcss.cls。
在dcss.cls中写入:
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 Function rsresult(strsql As String) As Recordset
Dim mycnn As Connection
Dim myset As Recordset
Dim strconnstring As String
'strconnstring = "provider=sqloledb.1;
password=;" & "user id=sa;" & "initial catalog=vlog;" & "data source=hpe60;
connect timeout=15"
strconnstring = "driver={sql server};server=yang;uid=sa;pwd=;
database=dcss"
'mycnn.ConnectionString = strconnstring
mycnn.Open strconnstring
myset.ActiveConnection = mycnn
myset.Open strsql, mycnn, 3, adCmdText
Set rsresult = myset
End Function
Public Function datasource() As Variant
datasource = "driver={sql server};server=yang;uid=sa;pwd=; database=dcss"
End Function
编译生成dcss.dll文件。注册regsvr32 路径dcss.dll。
用visual interdev打开global.asa文件.当然了,你也可以在其它文件中使用。
set dcss=server.CreateObject("yygwy.dcss")
oconn=dcss.datasource()
application("strconn")=oconn
在其它的页面中如下调用即可:
set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open application("strconn")
我也不太懂,我们可以共同分析一下。
[此贴子已经被作者于2007-9-14 15:34:58编辑过]