FileRequestEvents:FileRequest
Data As String
If TrapFileEnable is set to TRUE (See Section 3.1.9), all incoming requests will fire the FileRequestEvents:FileRequest event. When this event is fired, WebX will pass the name of the requested object (HTML page, gif file, etc.) and the entire Query String to the application. The developer can then decide if they want to TRAP the page and provide the output to the client or if WebX should try to honor the request. See the example below.
Parameter | Type | Description | |
Index | Integer | The index of the connection requesting a file. | |
FileName | String | The name of the file being requested. The virtual path is included in file. E.g. If you request the following page http://www.mydomain.com/products/index.html, FileName will contain /products/index.html. | |
UserAuthentication | String | The user name and password for restricted directories. The format is: username:password. | |
Table 3.3.1 – FileRequestEvents:FileRequest Event Parameters
For Example:
Private Sub WebX1_FileRequestEvents:FileRequest(Index As Integer, FileName As String) |
If UCase(FileName) = UCase("/trap.html") Then
Debug.Print FileName & QueryStringMethods:QueryString
' Send data back to Server Engine
WebX1.TrapFileDataMethods:TrapFileData Index, "A Trapped Page.", False
Else
WebX1.TrapFileDataMethods:TrapFileData Index, "", True
End If
End Sub
In the above example, if FileName is trap.html, then the test "A trapped Page. " will be sent to the client. Otherwise, WebX1.TrapFileDataMethods:TrapFileData Index, "", True is executed which forwards the request back to WebX. See Section 3.2.14 for more information on the method TrapFileData.