SlideShare a Scribd company logo
adRotator.aspx 
(3 of 4) 
51 </asp:RequiredFieldValidator> 
52 </td> 
53 </tr> 
54 </table> 
55 
56 <br /> 
57 Do you like ice cream? 
58 
59 <asp:RadioButtonList id = "iceCream" runat = "server"> 
60 <asp:ListItem>Yes</asp:ListItem> 
61 <asp:ListItem>No</asp:ListItem> 
62 </asp:RadioButtonList> 
63 
64 <br /> 
65 How many scoops would you like? (0-45) 
66 
67 <asp:TextBox id = "scoops" runat = "server" /> 
68 
69 <br /> 
70 <asp:button text = "Submit" OnClick = "submitButton_Click" 
71 runat = "server"/> 
72 
73 <asp:RangeValidator 
74 ControlToValidate = "scoops" 
75 MinimumValue = "0"
adRotator.aspx 
(4 of 4) 
76 MaximumValue = "45" 
77 Type = "Integer" 
78 EnableClientScript = "false" 
79 Text = "We cannot give you that many scoops." 
80 runat = "server" /> 
81 
82 <center> 
83 <h1> <asp:label id = "message" runat = "server"/> </h1> 
84 </center> 
85 
86 </form> 
87 </body> 
88 </html>
ads.xml 
(1 of 2) 
1 <?xml version = "1.0" ?> 
2 
3 <!-- Fig. 23.14: ads.xml --> 
4 <!-- Flag database --> 
5 
6 <Advertisements> 
7 
8 <Ad> 
9 <ImageUrl>images/unitedstates.png</ImageUrl> 
10 <NavigateUrl>http://www.usa.worldweb.com/</NavigateUrl> 
11 <AlternateText>US Tourism</AlternateText> 
12 <Impressions>80</Impressions> 
13 </Ad> 
14 
15 <Ad> 
16 <ImageUrl>images/germany.png</ImageUrl> 
17 <NavigateUrl>http://www.germany-tourism.de/</NavigateUrl> 
18 <AlternateText>German Tourism</AlternateText> 
19 <Impressions>80</Impressions> 
20 </Ad> 
21 
22 <Ad> 
23 <ImageUrl>images/spain.png</ImageUrl> 
24 <NavigateUrl>http://www.tourspain.es/</NavigateUrl> 
25 <AlternateText>Spanish Tourism</AlternateText>
ads.xml 
(2 of 2) 
26 <Impressions>80</Impressions> 
27 </Ad> 
28 
29 </Advertisements>
23.6 Web Forms 
Fig. 23.15 ASPX page with an AdRotator.
23.7 Session Tracking 
• Personalization 
• Protection of privacy 
• Cookies 
• .NET’s HttpSessionState object 
• Use of input form elements of type “hidden” 
• URL rewriting
23.7.1 Cookies 
• Customize interactions with Web pages 
• Stored by a Web site on an individual’s 
computer 
• Reactivated each time the user revisits site
cookie.aspx 
(1 of 2) 
1 <%@ Page Language="JScript" Debug="true" %> 
2 
3 <!-- Fig. 23.16: cookie.aspx --> 
4 <!-- Records last visit --> 
5 
6 <html> 
7 <head> 
8 <title> Simple Cookies </title> 
9 
10 <script runat = "server"> 
11 
12 function Page_Load( object : Object, events : EventArgs ) 
13 { 
14 var lastVisit : String; 
15 
16 if ( Request.Cookies( "visit" ) == null ) 
17 { 
18 welcome.Text = "This is the first time that " + 
19 "you have visited this site today"; 
20 } 
21 else 
22 { 
23 lastVisit = Request.Cookies( "visit" ).Value; 
24 welcome.Text = "You last visited the site at " + 
25 lastVisit + ".";
cookie.aspx 
(2 of 2) 
26 } 
27 
28 var time : DateTime = DateTime.Now; 
29 Response.Cookies( "visit" ).Value = time.ToString(); 
30 Response.Cookies( "visit" ).Expires = time.AddDays( 1 ); 
31 
32 } // end Page_Load 
33 </script> 
34 </head> 
35 <body> 
36 <form runat = "server"> 
37 <asp:label id = "welcome" runat = "server"/> 
38 </form> 
39 </body> 
40 </html>
23.7.1 Cookies 
Property Description 
Domain Returns a String containing the cookie’s domain (i.e., the domain of 
the Web server from which the cookie was downloaded). This determines 
which Web servers can receive the cookie. By default, cookies are sent to 
the Web server that originally sent them to the client. 
Expires Returns a DateTime object indicating when the browser can delete the 
cookie. 
Name Returns a String containing the cookie’s name. 
Path Returns a String containing the URL prefix for the cookie. Cookies 
can be “targeted” to specific URLs that include directories on the Web 
server, enabling the programmer to specify the location of the cookie. By 
default, a cookie is returned to services operating in the same directory as 
the service that sent the cookie or a subdirectory of that directory. 
Secure Returns a Boolean value indicating whether the cookie should be 
transmitted through a secure protocol. The value True causes a secure 
protocol to be used. 
Value Returns a String containing the cookie’s value. 
Fig. 23.17 HttpCookie properties.
23.7.2 Session Tracking with 
HttpSessionState 
Property Description 
Count Specifies the number of key-value pairs in the 
Session object. 
IsNewSession Indicates whether this is a new session (i.e., whether 
the session was created during loading of this page). 
IsReadOnly Indicates whether the Session object is read only. 
Keys Returns an object containing the Session object’s 
keys. 
SessionID Returns the session’s unique ID. 
Timeout Specifies the maximum number of minutes during 
which a session can be inactive (i.e., no requests are 
made) before the session expires. By default, this 
property is set to 20 minutes. 
Fig. 23.18 HttpSessionState properties.
optionsPage.aspx 
(1 of 6) 
1 <%@ Page Language="JScript" %> 
2 <%@ Import Namespace="System" %> 
3 
4 <%-- Fig. 23.19: optionsPage.aspx --%> 
5 <%-- Page that presents a list of language options. --%> 
6 
7 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
8 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
9 
10 <html> 
11 <head> 
12 <title>Options Page</title> 
13 
14 <script runat = "server"> 
15 
16 // event handler for Load event 
17 var books : Hashtable = new Hashtable(); 
18 
19 function Page_Load( sender : Object, events : EventArgs ) : void 
20 { 
21 // if page is loaded due to postback, load session 
22 // information, hide language options from user 
23 books.Add( "C#", "0-13-062221-4" ); 
24 books.Add( "C++", "0-13-089571-7" ); 
25 books.Add( "C", "0-13-089572-5" );
optionsPage.aspx 
(2 of 6) 
26 books.Add( "Python", "0-13-092361-3" ); 
27 
28 if ( IsPostBack ) 
29 { 
30 // display components that contain 
31 // session information 
32 welcomeLabel.Visible = true; 
33 languageLink.Visible = true; 
34 recommendationsLink.Visible = true; 
35 
36 // hide components 
37 submitButton.Visible = false; 
38 promptLabel.Visible = false; 
39 languageList.Visible = false; 
40 
41 // set labels to display Session information 
42 if ( languageList.SelectedItem != null ) 
43 { 
44 welcomeLabel.Text += 
45 languageList.SelectedItem.ToString() + "."; 
46 } 
47 else 
48 { 
49 welcomeLabel.Text += "no language."; 
50 }
optionsPage.aspx 
(3 of 6) 
51 
52 idLabel.Text += "Your unique session ID is: " + 
53 Session.SessionID; 
54 
55 timeoutLabel.Text += "Timeout: " + 
56 Session.Timeout + " minutes"; 
57 } // end if 
58 } // end Page_Load 
59 
60 // when user clicks Submit button, 
61 // store user's choice in session object 
62 function submitButton_Click ( 
63 sender : Object, events : EventArgs ) : void 
64 { 
65 if ( languageList.SelectedItem != null ) 
66 { 
67 var language : String = 
68 languageList.SelectedItem.ToString(); 
69 
70 // note: must use ToString method because the hash table 
71 // stores information as objects 
72 var ISBN : String = books[ language ].ToString(); 
73 
74 // store in session as name-value pair 
75 // name is language chosen, value is
optionsPage.aspx 
(4 of 6) 
76 // ISBN number for corresponding book 
77 Session.Add( language, ISBN ); 
78 } // end if 
79 } // end submitButton_Click 
80 
81 </script> 
82 </head> 
83 <body> 
84 <form id = "recommendationsPage" method = "post" runat = "server"> 
85 <P> 
86 <asp:Label id = "promptLabel" runat = "server" 
87 Font-Bold = "True">Select a programming language: 
88 </asp:Label> 
89 <asp:Label id = "welcomeLabel" runat = "server" 
90 Font-Bold = "True" Visible = "False"> 
91 Welcome to Sessions! You selected 
92 </asp:Label> 
93 </P> 
94 <P> 
95 <asp:RadioButtonList id = "languageList" runat = "server"> 
96 <asp:ListItem Value = "C#">C#</asp:ListItem> 
97 <asp:ListItem Value = "C++">C++</asp:ListItem> 
98 <asp:ListItem Value = "C">C</asp:ListItem> 
99 <asp:ListItem Value = "Python">Python</asp:ListItem> 
100 </asp:RadioButtonList></P>

More Related Content

KEY
Practical Use of MongoDB for Node.js
PDF
VBA API for scriptDB primer
PPTX
Goa tutorial
PPTX
Performances & SEO in AngularJS
ODP
Android query
PPTX
Dwr explanation
PPTX
[MongoDB.local Bengaluru 2018] Just in Time Validation with JSON Schema
Practical Use of MongoDB for Node.js
VBA API for scriptDB primer
Goa tutorial
Performances & SEO in AngularJS
Android query
Dwr explanation
[MongoDB.local Bengaluru 2018] Just in Time Validation with JSON Schema

What's hot (20)

PDF
Streaming using Kafka Flink & Elasticsearch
PPTX
Building Your First Data Science Applicatino in MongoDB
PPTX
Cnam azure 2014 mobile services
PPT
PPTX
Client Web
KEY
MongoDB
PPTX
Delex 2020: Deep diving into the dynamic provisioning of GlusterFS volumes in...
PDF
Do something in 5 with gas 9-copy between databases with oauth2
PDF
Node.js 與 google cloud storage
KEY
Mongo db presentation
PPTX
Using Change Streams to Keep Up with Your Data
PDF
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
PDF
Elasticsearch und die Java-Welt
PDF
Taking Web Apps Offline
PPTX
Redis data modeling examples
PPTX
Back to Basics: My First MongoDB Application
PPTX
[MongoDB.local Bengaluru 2018] Using Change Streams to Keep Up With Your Data
PDF
Map/Confused? A practical approach to Map/Reduce with MongoDB
PDF
Use Kotlin scripts and Clova SDK to build your Clova extension
PPTX
KEYNOTE: Node.js interactive 2017 - The case for node.js
Streaming using Kafka Flink & Elasticsearch
Building Your First Data Science Applicatino in MongoDB
Cnam azure 2014 mobile services
Client Web
MongoDB
Delex 2020: Deep diving into the dynamic provisioning of GlusterFS volumes in...
Do something in 5 with gas 9-copy between databases with oauth2
Node.js 與 google cloud storage
Mongo db presentation
Using Change Streams to Keep Up with Your Data
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Elasticsearch und die Java-Welt
Taking Web Apps Offline
Redis data modeling examples
Back to Basics: My First MongoDB Application
[MongoDB.local Bengaluru 2018] Using Change Streams to Keep Up With Your Data
Map/Confused? A practical approach to Map/Reduce with MongoDB
Use Kotlin scripts and Clova SDK to build your Clova extension
KEYNOTE: Node.js interactive 2017 - The case for node.js
Ad

Similar to Synapse india dotnet development web approch part 2 (20)

PDF
ASP.NET-Web Programming - Sessions and Cookies
PDF
state management asp.net
PPTX
Cookie & Session In ASP.NET
PPT
Active server pages
PPT
Session and cookies,get and post methods
PPTX
Sessions&cookies
PPTX
Chapter 8 part1
PDF
Asp.net state management
PPT
State management in ASP.NET
PPTX
19_JavaScript - Storage_Cookies-tutorial .pptx
PPT
Session and state management
PPT
State management
PDF
Session and Cookies.pdf
PPTX
Cookies
PPT
The complete ASP.NET (IIS) Tutorial with code example in power point slide show
PPSX
ASP.Net Presentation Part3
PPTX
Cookies: HTTP state management mechanism
PPTX
State Management in ASP.NET
PPTX
COOKIES.pptx
PPTX
ASP.NET-Web Programming - Sessions and Cookies
state management asp.net
Cookie & Session In ASP.NET
Active server pages
Session and cookies,get and post methods
Sessions&cookies
Chapter 8 part1
Asp.net state management
State management in ASP.NET
19_JavaScript - Storage_Cookies-tutorial .pptx
Session and state management
State management
Session and Cookies.pdf
Cookies
The complete ASP.NET (IIS) Tutorial with code example in power point slide show
ASP.Net Presentation Part3
Cookies: HTTP state management mechanism
State Management in ASP.NET
COOKIES.pptx
Ad

More from Synapseindiappsdevelopment (20)

PPTX
Synapse india elance top in demand in it skills
PPT
SynapseIndia dotnet web development architecture module
PPT
SynapseIndia dotnet module development part 1
PPT
SynapseIndia dotnet framework library
PPT
SynapseIndia dotnet development platform overview
PPT
SynapseIndia dotnet development framework
PPT
SynapseIndia dotnet web applications development
PPT
SynapseIndia dotnet website security development
PPT
SynapseIndia mobile build apps management
PPT
SynapseIndia mobile apps deployment framework internal architecture
PPT
SynapseIndia java and .net development
PPT
SynapseIndia dotnet development panel control
PPT
SynapseIndia dotnet development ajax client library
PPT
SynapseIndia php web development
PPT
SynapseIndia mobile apps architecture
PPT
SynapseIndia mobile apps deployment framework architecture
PPT
SynapseIndia mobile apps
PPT
SynapseIndia dotnet development
PPT
SynapseIndia dotnet client library Development
PPT
SynapseIndia creating asp controls programatically development
Synapse india elance top in demand in it skills
SynapseIndia dotnet web development architecture module
SynapseIndia dotnet module development part 1
SynapseIndia dotnet framework library
SynapseIndia dotnet development platform overview
SynapseIndia dotnet development framework
SynapseIndia dotnet web applications development
SynapseIndia dotnet website security development
SynapseIndia mobile build apps management
SynapseIndia mobile apps deployment framework internal architecture
SynapseIndia java and .net development
SynapseIndia dotnet development panel control
SynapseIndia dotnet development ajax client library
SynapseIndia php web development
SynapseIndia mobile apps architecture
SynapseIndia mobile apps deployment framework architecture
SynapseIndia mobile apps
SynapseIndia dotnet development
SynapseIndia dotnet client library Development
SynapseIndia creating asp controls programatically development

Recently uploaded (20)

PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPT
Teaching material agriculture food technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Machine Learning_overview_presentation.pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Network Security Unit 5.pdf for BCA BBA.
Chapter 3 Spatial Domain Image Processing.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Building Integrated photovoltaic BIPV_UPV.pdf
Teaching material agriculture food technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
cuic standard and advanced reporting.pdf
Encapsulation_ Review paper, used for researhc scholars
Machine Learning_overview_presentation.pptx
Assigned Numbers - 2025 - Bluetooth® Document
Spectral efficient network and resource selection model in 5G networks
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
NewMind AI Weekly Chronicles - August'25-Week II
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The AUB Centre for AI in Media Proposal.docx
sap open course for s4hana steps from ECC to s4
Network Security Unit 5.pdf for BCA BBA.

Synapse india dotnet development web approch part 2

  • 1. adRotator.aspx (3 of 4) 51 </asp:RequiredFieldValidator> 52 </td> 53 </tr> 54 </table> 55 56 <br /> 57 Do you like ice cream? 58 59 <asp:RadioButtonList id = "iceCream" runat = "server"> 60 <asp:ListItem>Yes</asp:ListItem> 61 <asp:ListItem>No</asp:ListItem> 62 </asp:RadioButtonList> 63 64 <br /> 65 How many scoops would you like? (0-45) 66 67 <asp:TextBox id = "scoops" runat = "server" /> 68 69 <br /> 70 <asp:button text = "Submit" OnClick = "submitButton_Click" 71 runat = "server"/> 72 73 <asp:RangeValidator 74 ControlToValidate = "scoops" 75 MinimumValue = "0"
  • 2. adRotator.aspx (4 of 4) 76 MaximumValue = "45" 77 Type = "Integer" 78 EnableClientScript = "false" 79 Text = "We cannot give you that many scoops." 80 runat = "server" /> 81 82 <center> 83 <h1> <asp:label id = "message" runat = "server"/> </h1> 84 </center> 85 86 </form> 87 </body> 88 </html>
  • 3. ads.xml (1 of 2) 1 <?xml version = "1.0" ?> 2 3 <!-- Fig. 23.14: ads.xml --> 4 <!-- Flag database --> 5 6 <Advertisements> 7 8 <Ad> 9 <ImageUrl>images/unitedstates.png</ImageUrl> 10 <NavigateUrl>http://www.usa.worldweb.com/</NavigateUrl> 11 <AlternateText>US Tourism</AlternateText> 12 <Impressions>80</Impressions> 13 </Ad> 14 15 <Ad> 16 <ImageUrl>images/germany.png</ImageUrl> 17 <NavigateUrl>http://www.germany-tourism.de/</NavigateUrl> 18 <AlternateText>German Tourism</AlternateText> 19 <Impressions>80</Impressions> 20 </Ad> 21 22 <Ad> 23 <ImageUrl>images/spain.png</ImageUrl> 24 <NavigateUrl>http://www.tourspain.es/</NavigateUrl> 25 <AlternateText>Spanish Tourism</AlternateText>
  • 4. ads.xml (2 of 2) 26 <Impressions>80</Impressions> 27 </Ad> 28 29 </Advertisements>
  • 5. 23.6 Web Forms Fig. 23.15 ASPX page with an AdRotator.
  • 6. 23.7 Session Tracking • Personalization • Protection of privacy • Cookies • .NET’s HttpSessionState object • Use of input form elements of type “hidden” • URL rewriting
  • 7. 23.7.1 Cookies • Customize interactions with Web pages • Stored by a Web site on an individual’s computer • Reactivated each time the user revisits site
  • 8. cookie.aspx (1 of 2) 1 <%@ Page Language="JScript" Debug="true" %> 2 3 <!-- Fig. 23.16: cookie.aspx --> 4 <!-- Records last visit --> 5 6 <html> 7 <head> 8 <title> Simple Cookies </title> 9 10 <script runat = "server"> 11 12 function Page_Load( object : Object, events : EventArgs ) 13 { 14 var lastVisit : String; 15 16 if ( Request.Cookies( "visit" ) == null ) 17 { 18 welcome.Text = "This is the first time that " + 19 "you have visited this site today"; 20 } 21 else 22 { 23 lastVisit = Request.Cookies( "visit" ).Value; 24 welcome.Text = "You last visited the site at " + 25 lastVisit + ".";
  • 9. cookie.aspx (2 of 2) 26 } 27 28 var time : DateTime = DateTime.Now; 29 Response.Cookies( "visit" ).Value = time.ToString(); 30 Response.Cookies( "visit" ).Expires = time.AddDays( 1 ); 31 32 } // end Page_Load 33 </script> 34 </head> 35 <body> 36 <form runat = "server"> 37 <asp:label id = "welcome" runat = "server"/> 38 </form> 39 </body> 40 </html>
  • 10. 23.7.1 Cookies Property Description Domain Returns a String containing the cookie’s domain (i.e., the domain of the Web server from which the cookie was downloaded). This determines which Web servers can receive the cookie. By default, cookies are sent to the Web server that originally sent them to the client. Expires Returns a DateTime object indicating when the browser can delete the cookie. Name Returns a String containing the cookie’s name. Path Returns a String containing the URL prefix for the cookie. Cookies can be “targeted” to specific URLs that include directories on the Web server, enabling the programmer to specify the location of the cookie. By default, a cookie is returned to services operating in the same directory as the service that sent the cookie or a subdirectory of that directory. Secure Returns a Boolean value indicating whether the cookie should be transmitted through a secure protocol. The value True causes a secure protocol to be used. Value Returns a String containing the cookie’s value. Fig. 23.17 HttpCookie properties.
  • 11. 23.7.2 Session Tracking with HttpSessionState Property Description Count Specifies the number of key-value pairs in the Session object. IsNewSession Indicates whether this is a new session (i.e., whether the session was created during loading of this page). IsReadOnly Indicates whether the Session object is read only. Keys Returns an object containing the Session object’s keys. SessionID Returns the session’s unique ID. Timeout Specifies the maximum number of minutes during which a session can be inactive (i.e., no requests are made) before the session expires. By default, this property is set to 20 minutes. Fig. 23.18 HttpSessionState properties.
  • 12. optionsPage.aspx (1 of 6) 1 <%@ Page Language="JScript" %> 2 <%@ Import Namespace="System" %> 3 4 <%-- Fig. 23.19: optionsPage.aspx --%> 5 <%-- Page that presents a list of language options. --%> 6 7 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 8 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 9 10 <html> 11 <head> 12 <title>Options Page</title> 13 14 <script runat = "server"> 15 16 // event handler for Load event 17 var books : Hashtable = new Hashtable(); 18 19 function Page_Load( sender : Object, events : EventArgs ) : void 20 { 21 // if page is loaded due to postback, load session 22 // information, hide language options from user 23 books.Add( "C#", "0-13-062221-4" ); 24 books.Add( "C++", "0-13-089571-7" ); 25 books.Add( "C", "0-13-089572-5" );
  • 13. optionsPage.aspx (2 of 6) 26 books.Add( "Python", "0-13-092361-3" ); 27 28 if ( IsPostBack ) 29 { 30 // display components that contain 31 // session information 32 welcomeLabel.Visible = true; 33 languageLink.Visible = true; 34 recommendationsLink.Visible = true; 35 36 // hide components 37 submitButton.Visible = false; 38 promptLabel.Visible = false; 39 languageList.Visible = false; 40 41 // set labels to display Session information 42 if ( languageList.SelectedItem != null ) 43 { 44 welcomeLabel.Text += 45 languageList.SelectedItem.ToString() + "."; 46 } 47 else 48 { 49 welcomeLabel.Text += "no language."; 50 }
  • 14. optionsPage.aspx (3 of 6) 51 52 idLabel.Text += "Your unique session ID is: " + 53 Session.SessionID; 54 55 timeoutLabel.Text += "Timeout: " + 56 Session.Timeout + " minutes"; 57 } // end if 58 } // end Page_Load 59 60 // when user clicks Submit button, 61 // store user's choice in session object 62 function submitButton_Click ( 63 sender : Object, events : EventArgs ) : void 64 { 65 if ( languageList.SelectedItem != null ) 66 { 67 var language : String = 68 languageList.SelectedItem.ToString(); 69 70 // note: must use ToString method because the hash table 71 // stores information as objects 72 var ISBN : String = books[ language ].ToString(); 73 74 // store in session as name-value pair 75 // name is language chosen, value is
  • 15. optionsPage.aspx (4 of 6) 76 // ISBN number for corresponding book 77 Session.Add( language, ISBN ); 78 } // end if 79 } // end submitButton_Click 80 81 </script> 82 </head> 83 <body> 84 <form id = "recommendationsPage" method = "post" runat = "server"> 85 <P> 86 <asp:Label id = "promptLabel" runat = "server" 87 Font-Bold = "True">Select a programming language: 88 </asp:Label> 89 <asp:Label id = "welcomeLabel" runat = "server" 90 Font-Bold = "True" Visible = "False"> 91 Welcome to Sessions! You selected 92 </asp:Label> 93 </P> 94 <P> 95 <asp:RadioButtonList id = "languageList" runat = "server"> 96 <asp:ListItem Value = "C#">C#</asp:ListItem> 97 <asp:ListItem Value = "C++">C++</asp:ListItem> 98 <asp:ListItem Value = "C">C</asp:ListItem> 99 <asp:ListItem Value = "Python">Python</asp:ListItem> 100 </asp:RadioButtonList></P>