A few days ago, my elder brother told me that using ASP is really troublesome, the compilation environment is really bad. He always wrote the code in VB and then paste the code to ASP to ASP
In the program, for this, I put forward a solution here. Use VB to replace all the objects of ASP and write pure ASP programs in VB.
Everyone should know that in fact, many components in ASP are written in VB, but what makes everyone feel very inconvenient is how to use ASP inherent.
This component, such as Response, Request, Application, Session, etc. If I can use these components directly in VB, then I can
Enough to use VB to write ASP to use the program.
The following is a detailed step:
1. Create a new Activex Dll in VB. I have omitted those naming projects and classes.
2. Now you need to reference two DLL in VB.
The first is to quote the DLL of the ASP engine.
Select the Project/References command from the menu, and quote the "Microsoft Active Server Pages Object Library '.
If you did not find it, you can find this asp.dll file%systemdirectory%/system32/INETSVR directory in the following directory
Click the button 'browse ...' to import this dynamic connection library
The second is to quote the Microsoft Transaction Server (MTS) object. Select the same command and quote
'Microsoft Transaction Server Type Library'.
If you did not find it, you can find this mtxas.dll file in the following directory
%SystemDirectory%/System32/MTS/3. Well, all the preparations are completed, how to write the code below, I think everyone can understand
of.
This is the code of the file:
option explicit
dim m_objresponse as response
dim m_objrequest as request
DIM M_OBJSERVER As Server
dim m_objapplication as application
dim m_objSession as session
Private sub class_initialize ()
Dim Objcontext as ObjectContext
set objcontext = getObjectContext ()
set m_objresponse = ObjContext (response)
set m_objrequest = ObjContext (request)
set m_objserver = ObjContext (server)
set M_Objapplication = ObjContext (Application)
set M_ObjSession = ObjContext (session)
end sub
Public Sub ASPTEST ()
M_OBJRESPONSE.WRITE farewell to the writing board, use the VB environment to write ASP program!
end sub
Paste the above code into your program, and then compile this project to DLL. Final use
Regsvr32 ComponentName.dll registered this DLL into IIS.
The following is the method of using this component in the ASP file:
<%
set object = server.createObject (yourprjname.asptest)
objtest.asptest
set object = nothing
%>
Well, I hope my method can solve the elder brother's distress, haha.