08.01.2015 Views

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

34<br />

CHAPTER 2 ■ BASICS OF WEB DEVELOPMENT WITH <strong>ASP</strong>.<strong>NET</strong><br />

As you can see, the stock quote application as rendered by the browser is very different<br />

from the stock quote application you saw in Listing 2-1. The controls have<br />

been replaced by pure HTML, the text box has been replaced by an input control of<br />

type "text", the button has been replaced by a form input control of type "submit", <strong>and</strong><br />

the label has been replaced by an HTML span. There are also a couple of new, hidden<br />

input controls, called __VIEWSTATE <strong>and</strong> __EVENTVALIDATION, which contain a series of<br />

characters.<br />

These fields simply contain a binary serialized representation of the page controls<br />

that are passed to the server <strong>and</strong> deserialized when the page inputs are submitted, or<br />

posted back, to the server. The server then uses this information to retrieve the contents<br />

of the controls (e.g., to reconstitute the text in the text box if the page is rerendered) <strong>and</strong><br />

to change them when necessary (e.g., to set the value of the label). This is the concept of<br />

page state management, which is implemented for you by <strong>ASP</strong>.<strong>NET</strong>.<br />

Using the <strong>Web</strong> Configuration File<br />

When you first ran the stock quote application, the IDE should have noticed that debugging<br />

wasn’t enabled, <strong>and</strong> would have asked if you wanted a default <strong>Web</strong>.config with<br />

debugging enabled. If you chose Yes, your project directory will include a new file,<br />

<strong>Web</strong>.config.<br />

This file is used to define how the .<strong>NET</strong> Framework should h<strong>and</strong>le your site. Information<br />

such as security, caching, debugging, <strong>and</strong> globalization settings are typically stored<br />

in <strong>Web</strong>.config.<br />

Here’s an example of the <strong>Web</strong>.config file:<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!