Visual Basic Concepts
Normally, you cannot control the way that users move through your IIS application. Unlike in a forms-based application where navigation from form to form is generally fixed, Web-based applications present a unique challenge because users can select the Back button, items from the History list, or other navigational aids to move in ways that you cannot predict.
If you want to ensure that users move in a set path through your application, you can use the URLData property to include sequencing information with the requests and responses the webclass handles. For example, suppose you have a webclass with three webitems. Item one is an introductory page, item two is a customer order form, and item three is a summary page that gives information about the current order. You want to prevent the user from moving directly from item one to item three.
The URLData property enables you to set a sequence number for each webclass request. When the property is set, the run-time DLL automatically parses the data object and appends the value you assigned to the property to each URL it finds embedded in a response. For example, if you have a URL that reads:
WCI=webitem1?WCE=event1
and you use the following code to set the URLData property:
WebClass1.URLData=01
the run-time DLL will append the value of the URLData property to the URL, using a WCU indicator. The resulting HTML looks like this:
WCI=webitem1?WCE=event1&WCU=01
This argument is passed to the client and stored there. On the next request, the browser includes the argument, telling the server that this request is the next in sequence after response 01.
At this point in your code, you would increment the value of the URLData property by one to indicate that a second response has been sent. You would do that with the following code:
WebClass1.URLData=02
When the webclass encounters this setting, it parses the response again and appends this number to all URLs. The number 02 is then sent to the browser and stored, to be returned on the next request that contains the URL.
You can ensure proper sequencing by writing code that determines whether the URLData argument received with each request is valid. For example, you would store the value of the argument after each request, using either a variable or an external store such as a database, then compare each new request to see if the correct number has been used. The following example shows the code you might use to ensure sequence on the second request:
If URLData = 02 Then
WebItem2.WriteTemplate
Else
'Code here to send an error to the browser
'and redirect to the previous page.
EndIf