Previously collected some information---use VB to write a pure ASP program (dedicated to brother)

Source: Internet
Author: User
Program using VB to write pure ASP program
A few days ago the eldest brother said to me, the use of ASP really trouble, the compilation environment is really bad, he always in VB to write good debugging
The code then pastes the code into the ASP program, for which I propose a solution. Using VB to replace ASP
All the objects, in VB to write a pure ASP program.
We should all know, in fact, many of the ASP components are written using VB, but let everyone feel very inconvenient
is how to use several inherent components of ASP, such as Response,request,application,session, and so on, if I
If you can use these components directly in VB, then you can directly use VB to write ASP application procedures.
The following are detailed steps:
1. Create a new ActiveX DLL in VB. I omitted the process of naming items and classes.
2. Now you need to refer to two DLLs in VB.
The first is the DLL that references the ASP engine.
Select the Project\references command from the menu to refer to ' Microsoft Active Server Pages Object Library '.
If you don't 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 refer to a Microsoft Transaction Server (MTS) object. Select the same command, reference
' Microsoft Transaction Server Type Library '.
If you don't find it, you can find this Mtxas.dll file in the following directory
%systemdirectory%/system32/mts/
3. OK, all the preparation work is done, the following is how to write the code, I think we can all understand.
This is the code for the class 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 WordPad, the use of VB environment to write ASP program!" "
End Sub

Paste the above code copy into your program, and then compile the project into a DLL. Last use
regsvr32 componentname.dll
Register this DLL in IIS.
Here's how to use this component in an ASP file:
&nbs



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.