Asp and coldfusion application variables – Adobe Dreamweaver CC 2014 v.13 User Manual
Page 635
ASP
<% Session("variable_name") = value %>
The value expression is usually a server expression such as Request.Form("lastname"). For example, if you use a URL parameter called product
(or an HTML form with the GET method and a text field called product) to gather information, the following statements store the information in a
session variable called prodID:
ColdFusion
ASP
<% Session("prodID") = Request.QueryString("product") %>
If you use an HTML form with the post method and a text field called txtProduct to gather the information, then the following statements store the
information in the session variable:
ColdFusion
ASP
<% Session("prodID") = Request.Form("txtProduct") %>
Example of information stored in session variables
You’re working on a site with a large audience of senior citizens. In Dreamweaver, add two links to the Welcome screen that let users customize
the size of the site’s text. For larger, easy-to-read text, the user clicks one link, and for regular-size text, the user clicks another link.
Each link has a URL parameter called fontsize that submits the user’s text preference to the server, as the following Adobe ColdFusion® example
shows:
Store the user’s text preference in a session variable and use it to set the font size on each page the user requests.
Near the top of the destination page, enter the following code to create a session called font_pref that stores the user’s font size preference.
ColdFusion
ASP
<% Session("font_pref") = Request.QueryString("fontsize") %>
When the user clicks the hypertext link, the page sends the user’s text preference in a URL parameter to the destination page. The code on the
destination page stores the URL parameter in the font_pref session variable. For the duration of the user’s session, all the pages of the application
retrieve this value and display the selected font size.
628