contents   index   previous   next



TrapFileData

 

If TrapFileEnable is set to TRUE, then FileRequest event will fire when a request is received by WebX. The developer can choose to inspect the name of the requested file and query string and also bypass the subsequent search for a file and return data directly to the client. The TrapFileData is used to return the data the application is to send to the client.

 

For example:


Private Sub WebX1_FileRequest(Index As Integer, FileName As String, UserAuthentication As String)
    If FileName = "/index.html" Then
    ' Request matched, so send back data
        WebX1.TrapFileData Index, "Index Page: Hello World!", False
    Else
        ' Let WebX handle the request
        WebX1.TrapFileData Index, "", True
    End If
End Sub


 

Parameter

Type

Description

Index

Integer

Used to link the returned data to the requesting connection.

Data

String

Contains the data to be sent to the requesting client.

[WebXProcess]

Boolean

Optional. Default Value = TRUE. If TRUE, the application will not send any data to the client and WebX will look for the file (HTML or binary) to be sent. If FALSE, the application will provide WebX the data to be sent to the client in Data.

[ContentType]

String

Optional. Default Value = "text/html". This is the Content Type (MIME) that is sent to the client.

 

TrapFileDataEx