Appendix

Exercise Answers

CHAPTER 1

Exercise 1 Solution

The easiest way to download and install WebMatrix is using the Web Platform Installer, which you can download from www.microsoft.com/web.

Exercise 2 Solution

A file with a CSHTML extension is called a C# Razor file. It typically contains a mix of plain markup (such as HTML, CSS, and JavaScript) and server-side code that uses the Razor syntax. A file with a CS extension contains pure C# code and cannot contain HTML or other markup directly. The same differences apply to VBHTML and VB files.

Exercise 3 Solution

There are at least three special folders you typically use in an ASP.NET Web Pages application. The App_Data folder is used to store data consumed by the application, such as database and XML files. The App_Code folder is used to store your code files (files with a CS or VB extension). Finally, the Bin folder is used to store your own or third-party assemblies (files with a DLL extension). Because these folders contain files that you don’t want your users to download, the web server blocks access to these folders for end users. Obviously, your application files and code can access them just fine.

Exercise 4 Solution

Static files are files that require no special processing and are served to the client by the web server directly. Dynamic files are processed by some other component first. For example, CSHTML files are processed by the ASP.NET run time first, executing the server-side code they contain to build up the final ...

Get Beginning ASP.NET Web Pages with WebMatrix® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.