|
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.
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.
|