ASP Components Intermediate beginner and proficient series of five
Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
Let's learn to look at the response object. In fact, we have been using the Write method of this object in previous tutorials.
Here we use the Response object to set cookies.
Open VB6 and create a new ActiveX DLL project. Project name modified to fcom, class name modified to FZ5
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:
' 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
??? ' 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
' Set cookies from the page, the component gets
Public Sub GetCookie ()
??? Dim myitem
??? ' All information
??? For Each myitem in Myrequest.cookies
??????? Myresponse.write myitem & ":" & MyRequest.Cookies.Item (myitem)
??????? Myresponse.write "
??? ' Single information
??? Myresponse.write "Where the user name is" & ":" & Myrequest.cookies ("username")
??? Myresponse.write "
??? Myresponse.write "in which the user age is &:" & Myrequest.cookies ("aged")
??? Myresponse.write "
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to firstname.lastname@example.org. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
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:
and provide relevant evidence. A staff member will contact you within 5 working days.