ASP Components Intermediate beginner and Proficient Series VI
Source: Internet
Author: User
As an ASP's built-in object, we end up learning about server objects
Server objects use more of HTML encoding, URL encoding and Web page redirection, transmission.
?
Open VB6 and create a new ActiveX DLL project. Project name modified to fcom, class name modified to FZ6
References the Microsoft Active Server Pages Object Library.
Create two component events: OnStartPage and OnEndPage
Creates a reference to the class Scriptingcontent in the event OnStartPage.
Instantiate class Scriptingcontent.
?
The code is as follows:
Option Explicit
' The Declaration of the object
Dim Myresponse as Response
Dim Myrequest as Request
Dim MyApplication as Application
Dim MyServer as Server
Dim MySession as session
?
??? ' Triggers this event when the component is created
Public Sub OnStartPage (myscriptingcontent as ScriptingContext)
???? ' To instantiate the object
???? Set Myresponse = Myscriptingcontent.response
???? Set myrequest = myscriptingcontent.request
???? Set MyServer = Myscriptingcontent.server
???? Set MyApplication = myscriptingcontent.application
???? Set mysession = myscriptingcontent.session
End Sub
?
??? ' Triggers this event when the component is destroyed
Public Sub OnEndPage ()
???? ' Destroy objects
???? Set Myresponse = Nothing
???? Set myrequest = Nothing
???? Set MyServer = Nothing
???? Set MyApplication = Nothing
???? Set mysession = Nothing
End Sub
?
Public Sub showhtml (ByVal strhtml as String)
??? Myresponse.write Myserver.htmlencode (strhtml)
End Sub
?
Public Sub Showurl (ByVal strURL as String)
??? Myresponse.write Myserver.urlencode (strURL)
End Sub
?
Public Sub Executeurl ()
??? Myserver.transfer "Fz5.asp"
End Sub
?
Compiled into a DLL file, the system will automatically register.
Otherwise, manually register Regsvr32 F:estfcom.dll
?
Test
Turn on visual interdev6.0 to generate a fz6.asp file
?
Configure the virtual directory, the execution of fc6.asp files in IE can be seen
Oh, test it.
Name=mrs+%c1%fa%be%ed%b7%e7&age=26
You can use IE to view the source file to see HTML encoding
?
?
?
ASP's built-in objects are temporarily introduced here, we will continue to learn in the back.
You can also extrapolate to learn the properties and methods that are not introduced.
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