把asp程序作成dll很多好處
怎樣在遠程主機上注冊我們的dll呢?在服務器端使用Shell!!!
讓我們先將自己的dll文件通過ftp或http上傳到服務器上
Set oShell = CreateObject (
oShell
當然如果對方的服務器安全搞的很好的話
在這裡也要提醒那些出租空間的朋友
完整代碼如下
<% Response
<% Server
Dim frmFolderPath
frmFolderPath = Request
frmFilePath = Request
frmMethod = Request
btnREG = Request
%>
<HTML>
<HEAD>
<TITLE>Regsvr
<STYLE TYPE=
MARGIN
TD {MARGIN
</STYLE>
</HEAD>
<BODY>
<FORM NAME=
<TABLE BORDER=
<TR>
<TD VALIGN=TOP>
<FIELDSET ID=FS
<LEGEND CLASS=Legend>Regsvr Functions</LEGEND>
Insert Path to DLL Directory<BR>
<INPUT TYPE=TEXT NAME=
<INPUT TYPE=SUBMIT NAME=btnFileList VALUE=
<%
IF Request
Set RegisterFiles = New clsRegister
RegisterFiles
Call RegisterFiles
RegisterFiles
&
IF Request
Call RegisterFiles
End IF
Set RegisterFiles = Nothing
End IF
%>
</FIELDSET>
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
<%
Class clsRegister
Private m_oFS
Public Property Let oFS(objOFS)
m_oFS = objOFS
End Property
Public Property Get oFS()
Set oFS = Server
End Property
Sub init(strRoot)
Dim oDrive
IF oFS
IF Len(strRoot) <
Set oDrive = oFS
Set oRootDir = oDrive
Else
Set oRootDir = oFS
End IF
Else
EchoB(
Exit Sub
End IF
setRoot = oRootDir
Echo(
Call getAllDlls(oRootDir)
EchoB(
BuildOptions
End Sub
Sub getAllDlls(oParentFolder)
Dim oSubFolders
Set oSubFolders = oParentFolder
Set opFiles = oParentFolder
For Each oFile in opFiles
IF Right(lCase(oFile
Echo(
& oFile
End IF
Next
On Error Resume Next
For Each oFolder In oSubFolders
Set oFiles = oFolder
For Each oFile in oFiles
IF Right(lCase(oFile
Echo(
& oFile
End IF
Next
Call getAllDlls(oFolder)
Next
On Error GoTo
End Sub
Sub Register(strFilePath
Dim theFile
Set theFile = oFS
strFile = theFile
Set oShell = CreateObject (
IF regMethod =
oShell
exitcode = oShell
EchoB(
Else
oShell
exitcode = oShell
EchoB(
End IF
Cleanup oShell
End Sub
Sub BuildOptions
EchoB(
EchoB(
End Sub
Function Echo(str)
Echo = Response
End Function
Function EchoB(str)
EchoB = Response
End Function
Sub Cleanup(obj)
If isObject(obj) Then
Set obj = Nothing
End IF
End Sub
Sub Class_Terminate()
Cleanup oFS
End Sub
End Class
%>
From:http://tw.wingwit.com/Article/program/net/201311/13897.html