ASP component intermediate entry and proficient series four

xiaoxiao2021-03-06  120

We learn to request

See how to get the content submitted in the component

Open VB6, create a new ActiveX DLL project. The engineering name is modified to FCOM, and the class name is modified to FZ4 reference "Microsoft Active Server Pages Object" object library. Create two component events: OnStartPage and OneundPage Create a reference to the class ScriptingContent in the event onstartpage. Instantiated class scriptingcontent.

code show as below:

Option expedition

'Statement of the object

DIM MyResponse as response

DIM MyRequest as Request

DIM MyApplication AS Application

DIM MyServer As Server

DIM MySession as session

'When the component is created, this event will be triggered.

Public Sub onstartPage (MyScriptingContent as scriptingcontext)

'Instantiation of objects

Set myresponse = myscriptingContent.response

Set myRequest = myscriptingcontent.request

Set myserver = myscriptingContent.server

SET myApplication = myscriptingcontent.application

Set mysession = myscriptingContent.Session

End Sub

'Trigger this event when the component is destroyed

Public Sub OneendPage ()

'Destroying object

Set myresponse = Nothing

Set myRequest = Nothing

Set myserver = Nothing

Set myapplication = Nothing

Set mysession = Nothing

End Sub

'It can be seen that put it in the previous ASP to VB, the way is the same.

Public Sub showRequest ()

DIM MyItem

'POST method

For Each MyItem in MyRequest.form

MyResponse.write myitem & ":" & myRequest.form (MyItem)

MyResponse.write "
"

NEXT

'Get

For Each MyItem in MyRequest.QueryString

MyResponse.write myitem & ":" & myRequest.QueryString (MyItem)

MyResponse.write "
"

NEXT

'Single information

MyResponse.write "one of these information is" & ":" & myrequest ("username")

MyResponse.write "
"

End Sub

test

Open Visual InterDev6.0 to generate a FZ41.asp file

<% @ Language = VBScript%>

You also need to generate a submitted FZ4_RESULT.ASP file

<% @ Language = VBScript%>

<%

DIM OBJ

Set obj = server.createObject ("fcom.fz4")

Call obj.showRequest

%>

In addition, we have to take a look at the GET method, so you need a FZ42.asp file.

<% @ Language = VBScript%>

Configure a virtual directory, execute the fc41.asp file in IE, enter the content, click the button, you can see

Username: Tornado Age: 26 Submitted: Submit One of the information is: tornado

Let's execute the FC42.asp file in IE, enter the content, click the button, you can see

Username: Tornado Age: 26 Submitted: Submit One of the information is: tornado

At the same time, the address bar has become

http: //yang/xml/fz4_result.asp? UserName =% C1% FA% be% ED% B7% E7

& agn = 26 &% CC% E1% BD% BB = SUBMIT

Last continued

转载请注明原文地址:https://www.9cbs.com/read-125639.html

New Post(0)