To continue with this content, please log in with your Data Access ID or create a new account.
Cancel Data Access ID
You may not be authorized to see this content. Please contact Data Access Europe for more information.
Cancel Data Access Europe
You are not authorized to see this content.
Cancel Data Access Europe
Next lesson:
Cancel

Web Properties

Lesson 2: Adding your own Web Properties

It is not difficult to create a Web Property. Start with creating a regular property, then annotate it with the type of property that needs to be used. A default value also needs to be set. In this example, a property Boolean has been created called ‘pbMyCustomProperty,’ and it has been annotated with {WebProperty = Client}. Its default value has been set to ‘True.’


The types of Web Properties to choose from:

  • Client: Value is stored at the client sent to the server with each call.
  • Server: Value is retrieved on server when needed, and it is page scoped. 
    • Page scoped means that the set property value will be gone when the page reloads.
  • ServerSession: Same as server, but it is session scoped.
    • Session scoped means that the set property value will remain even after the page reloads.


The value of the Web Properties, for both Server and ServerSession, are stored in a table at the WebApp.


Demonstration

  1. Three properties are shown with default values applied:
    1. psCustomPerpertyClient
    2. psCustomPropertyServer
    3. psCustomServerSession
  2. The web browser’s Console allows the application to be somewhat manipulated and certain values retrieved and set.
  3. Getting the value of ‘psCustomPropertyClient’ shows the default value. Doing the same for ‘psCustomPropertyServer’ and ‘psCustomServerSession’ will return an “undefined” value. This is because the values for Server and SessionServer WepProperties are kept in tables, which is much more secure.
  4. These values can also be changed through the Console. This is shown using ‘psCustomPropertyClient’ because Client values are stored locally. This cannot be done to Server and ServerSession WebProperties. In the example, the client is ‘Set’ to display “I hacked the system!,” and is shown to work using another ‘Get.’
  5. NOTE: Never use a Client WebProperty for sensitive values. They can be found and/or altered to easily.
  6. The differences between the Server and ServerSession scoping differences…
  7. Server is page scoped
  8. Selecting the ‘WebGet Server Property’ button results in “Server default value”
  9. Selecting the ‘WebSet’ button then sets the value to “Server property has changed”
  10. Selecting the ‘WebGet Server Property’ button again now shows that the new value has been changed to “Server property has changed,” and will continue to do so no matter how many times you select the button.
  11. Refreshing the page, and then selecting the ‘WebGet Server Property’ button clears the value and resets it to “Server default value”
  12. ServerSession is session scoped
  13. Selecting the ‘WebGet ServerSession Property’ button results in “Server default value”
  14. Selecting the ‘WebSet’ button then sets the value to “Server property has changed”
  15. Selecting the ‘WebGet ServerSession Property’ button again now shows that the new value has been changed to “Server property has changed,” and will continue to do so no matter how many times you select the button. 
  16. Refreshing the page, and then selecting the ‘WebGet ServerSession Property’ button will continue to show the “Server property has changed” value. It remembers the values set during the session.