Chapter 7: Creating a Random Quotes Page


Overview

Many people like to display quotations on their Web sites, perhaps as a thought of the day for visitors to the site. In this chapter, you ll learn how to use Web Matrix to create a Web page that displays a different quotation each time the page is displayed. Your Web page might look something like the page shown in Figure 7-1.

click to expand
Figure 7-1: A random quotes page.

Even if you re not specifically interested in displaying quotations, you ll find the techniques described in this chapter useful. For example, you ll learn how to program a Web page that can read from a text file. You ll learn how to read from databases in later chapters, but it s always useful to know how to work with standard text files. You ll also learn about error handling that is, how to anticipate problems and fail gracefully. Interacting with external resources such as files or databases is inherently error-prone; because these resources can change outside of your control, you need to code defensively in these situations. In addition, you ll learn techniques for manipulating strings and generating random numbers. The last technique you ll learn is how to cache (store) information in server memory so that it s readily available to all the pages in your application.




Microsoft ASP. NET Web Matrix Starter Kit
Microsoft ASP.NET Web Matrix Starter Kit (Bpg-Other)
ISBN: 0735618569
EAN: 2147483647
Year: 2003
Pages: 169
Authors: Mike Pope
BUY ON AMAZON

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net