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.

CHAPTER 3<br />

<strong>Web</strong> Forms with <strong>ASP</strong>.<strong>NET</strong><br />

At the heart of web applications <strong>and</strong> web sites in <strong>ASP</strong>.<strong>NET</strong> are the elements that you use<br />

to build the pages that the user will see. These are called web forms, terminology that is a<br />

holdover from Windows development when windows were built using forms.<br />

This methodology is unique <strong>and</strong> innovative in web development. It enables you to<br />

create your pages in a visual manner, using server-side controls (as you saw in Chapter 2)<br />

that are converted into HTML markup by the <strong>ASP</strong>.<strong>NET</strong> runtime at the time they are<br />

served to the client. This chapter will go into some detail about web forms <strong>and</strong> how they<br />

work in <strong>ASP</strong>.<strong>NET</strong>. You’ll learn about the event model of a page, <strong>and</strong> how postbacks work.<br />

This chapter will also show you the life cycle of a page, <strong>and</strong> it will go into the object<br />

model that the page supports, going through the control tree that <strong>ASP</strong>.<strong>NET</strong> exposes to<br />

you as a developer. Finally, you’ll take an in-depth look at the Page class, <strong>and</strong> how it can<br />

be used to control the flow between the server <strong>and</strong> your users, enabling you to access the<br />

request <strong>and</strong> response streams, <strong>and</strong> parse <strong>and</strong>/or override them as necessary.<br />

By the end of the chapter, you’ll have a good underst<strong>and</strong>ing of how web forms work,<br />

<strong>and</strong> how you can use them to add great power to your web applications.<br />

Underst<strong>and</strong>ing Page Processing<br />

It is important to underst<strong>and</strong> that there are a number of major differences between<br />

building web applications <strong>and</strong> building st<strong>and</strong>ard Windows client applications. If you are<br />

coming to web development from a Windows client development background, there are<br />

several aspects of web development that are significantly different from Windows client<br />

application development. Most Windows applications are designed to work with a single<br />

user, but web applications that don’t scale to thous<strong>and</strong>s of users are considered a failure.<br />

Also, the application from a user’s perspective executes in a web browser, so local file system<br />

permissions <strong>and</strong> system access is very limited. And perhaps the hardest concept to<br />

grasp if you’re used to virtually unlimited memory <strong>and</strong> computational horsepower is that<br />

web applications are by <strong>and</strong> large stateless, meaning that information isn’t retained on<br />

the server between page invocations. (There are techniques to bypass this obstacle, but<br />

even those require some design thought.)<br />

37

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

Saved successfully!

Ooh no, something went wrong!