Create web applications using Real Studio
Issue: 10.4 (May/June 2012)
Author: Paul Lefebvre
Article Description: No description available.
Article Length (in bytes): 2,901
Starting Page Number: 77
RBD Number: 10411
Resource File(s): None
Related Link(s): None
Known Limitations: None
Excerpt of article text...
All web sites and web applications have a standard way of retaining user data: cookies. Real Studio web applications also have several methods for accessing cookies, all of which are part of the Session class.
So what is a cookie? It is just string data that is retained by the browser so that it can be retrieved later. Cookies are stored for each session so that the values that you save for each user are completely independent.
Cookies have limitations. The biggest is that they might not be enabled. Users can choose to disable cookies in their browser security settings. Most users do not do this since it breaks much of the way the web works, but it is something to keep in mind.
Saving a Value with a Cookie
To save a value with a Cookie, you simply set the Cookie. This code sets a cookie called "UserName" to the value in the userName string:
By default, cookies expire when the browser is closed. These are called "session cookies."
For some values, you may want to retain the cookie so that it is available the next time the user connects to your web application. These are called "persistent cookies."
...End of Excerpt. Please purchase the magazine to read the full article.
Article copyrighted by REALbasic Developer magazine. All rights reserved.