This is one we often see when developers transition from building Windows Applications to their first Web Application. In Windows, accessing properties is done using Get and storing properties is done using Set. Because the application is running locally and is a single process, this works as you’d expect it to.
In a Web environment however, this works a little different.
As we’ve discussed in the previous lesson, when building Web Applications you often have multiple processes on the server handling calls from the client. If you were to in one call store a property value using Set, and in the next call try to get that property using Get, chances are you will probably get a different value than you expected.
For the Web, we can make use of a specific kind of Properties called WebProperties. These come in various types, but the important thing to note is that their value gets stored either on the client or in a special table on the server. When accessing these WebProperties, it will try to get it from this table or the client based on the type of property. This ensures that the property value is always correct, regardless of what process is handling it.
To use WebProperties there are 2 specific commands to keep in mind:
Does this mean you should avoid using Get and Set entirely in a Web Application? Not at all. In general, keep the following rules in mind:
We have an entire course on Web Properties on the DataFlex Learning Center, which will go more into depth!