Ice06Applications and Sessions: The Visitor Game

Note:  Please keep the programs that you create today, in case you have a question about your grades for the ICEs at the end of the quarter. When you're working with a partner, each person should save his-or-her own copy.

Objectives

Resources

Clarify the relationship between an Application and a Session object in a web application

 

ICE ICE 06 Part 1: The Visitor Game Online

The files that comprise the Visitors Game application have purposefully made use of different code types (ASP.NET, HTML, CSS, JavaScript, etc) to demonstrate how a mishmash of styles can overlap and be used in the construction of an application. It's not pretty, and there are certainly more elegant ways to do it, but it suits its purpose.

  1. Play the Visitors Game online with your classmates.
  2. Try to guess which information in the game is stored as Session data and which information is stored as Application data.

ICE ICE 06 Part 2: The Visitor Game Code

  1. Download the visitorGame.zip file and unzip to the desktop (or folder of your choice).
  2. Open the visitGame web site in Visual Studio, and run the game to ensure it works as planned.
  3. Open and review all the files. Examine the code in each file. Try to determine how all the files work together to produce the working game.
  • Default.aspx
  • Default.aspx.cs
  • checkVisitors.aspx
  • checkVisitors.aspx.cs
  • Web.config
  • Web.Debug.config
  • Global.asax

Some of the code will contain elements we haven't discussed yet in the class, like the validation portions, which won't be looked at until Lecture 8. This is intentional. As a developer, a lot of the code you will come across will be new to you, and its up to you to be proactive to research it in order to figure out what it does, how it works, how it might work in different ways, etc.

ICE ICE 06 Part 3: The Web.config File

  1. Look at the web.config files. Why do you suppose the <appSettings> section was added to the files?
  2. Comment out the <appSettings> section in the web.config files and run the program again. Test all the features of the program.
  3. If the program breaks, do the research and try to understand why. Is there another way to 'fix' the problem different than the way used here? Try this different way to implement the fix. Does it work?

ICE ICE 06 Part 4: Add a User Session Count

  1. Create a variation of the Visitor Game that tracks the number of user sessions currently active in the application. Your winning Visitor page might look something like this:

ICE ICE 06 Part 5: Quit Game Button

  1. You might also experiment with the Session.Abandon() method attached to a Quit Game button which would allow users to actively quit the game, removing session information.

When you get done with this exercise, show your Instructor.