Web Resources

Answers to Self Review Exercises

21.1

a) True. b) False. Web.config is the file that stores configuration settings for an ASP.NET Web application. c) False. An unlimited number of validation controls can be placed on a Web Form. d) True. e) False. A LoginName control displays the current authenticated user name on a Web Form. A LoginStatus control displays a link to either log in or log out, depending on whether the user is currently authenticated. f) True. g) False. The frequency with which the AdRotator displays ads is specified in the AdvertisementFile. h) False. A Web control can map to a group of XHTML elementsASP.NET can generate complex XHTML markup from simple elements in an ASPX file. i) True.

21.2

a) bottom (information), middle (business logic), top (client). b) DropDownList. c) validator. d) postback. e) Page. f) Init, Load. g) code-behind. h) CreateUserWizard. i) master page, content pages. j) middle.

Exercises

21.3

(WebTime Modification) Modify the WebTime example to contain drop-down lists that allow the user to modify such Label properties as BackColor, ForeColor and FontSize. Configure these drop-down lists so that a postback occurs whenever the user makes a selection. When the page reloads, it should reflect the specified changes to the properties of the Label displaying the time.

21.4

(Page Hit Counter) Create an ASP.NET page that uses a persistent cookie (i.e., a cookie with a distant expiration date) to keep track of how many times the client computer has visited the page. Set the HttpCookie object's Expires property to DateTime.Now.AddMonths(1) to cause the cookie to remain on the client's computer for one month. Display the number of page hits (i.e., the cookie's value) every time the page loads.

21.5

(WebControls Modification) Provide the following functionality for the example in Section 21.5.1: When users click Register, store their information in the Users table of the Registration.mdf database (provided in the chapter's examples directory). On postback, thank the user for providing the information.

21.6

(Guestbook Application Modification) Add validation to the guestbook application in Section 21.7. Use validation controls to ensure that the user provides a name, a valid e-mail address and a message.

Web Services

Категории