ASP Components Intermediate Getting Started with Examination Series

xiaoxiao2021-03-06  50

As an ASP's built-in object, let's finalize Server objects

The more than the server object is HTML encoding, URL encoding, and page redirection, transfer.

?

Open VB6, create a new ActiveX DLL project. The engineering name is modified to FCOM and the class name is modified to FZ6 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, it will trigger this event.

Public Sub onstartPage (MyScriptingContent as scriptingcontext)

???? 'Installation of objects

???? set myresponse = myscriptingContent.response

???? set myRequest = myscriptingContent.request

???? set myserver = myscriptingcontent.server

???? set myapplication = myscriptingContent.Application

???? set myations = myscriptingContent.Session

End Sub

?

??? 'When the component is destroyed, it triggers this event.

Public Sub OneendPage ()

???? 'destroyed object

???? 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 Strurn 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, register with regr32 f: /test/fcom.dll

?

test

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

<% @ Language = VBScript%>

<%

DIM OBJ

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

Obj.showhtml

Oh, tested "

Response.write ""

Response.write "name ="

Obj.Showurl ("MRS Tornado")

Response.write "& ag =" Obj.showurl ("26")

?

Response.write ""

Call Obj.executeurl ()

%>

?

Configure a virtual directory, perform FC6.asp files in IE, you can see

Oh, tested

Name = MRS % C1% FA% be% ED% B7% E7 & AGE = 26

You can use the IE view source file to see HTML encoding

?

?

?

ASP's built-in object is temporarily introduced here, and we will also learn anything.

Everyone can also raise an antipyrett, the properties and methods that have not been introduced.

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

New Post(0)