Using VB to write pure ASP program

Source: Internet
Author: User
A few days ago the eldest brother said to me, the use of ASP really troublesome, the compilation environment is really bad, he always in VB to write good debugging code and then in the code pasted to ASP
program, and to that end, I propose a solution here. Using VB to replace all the objects of ASP, 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 the ASP inherent several
components, such as response,request,application,session, and so on, if I can use these components directly in VB, then I can
Enough to 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 Projectreferences 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. Okay, all the preparation is done, here's how to write the code, I think we all can see
Of
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!" "

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.