Workshop


Quiz

1.

What are the germane differences between a form with its method attribute set to GET versus a form with its method attribute set to POST?

2.

Imagine that you saw the following querystring:

SomePage.aspx?SSN=123-45-6789&age=24&gender=M 


What does this tell you about the form that the user filled out?

3.

What are the differences between postback forms and redirect forms?

4.

What types of forms do ASP.NET Web Forms use?

Answers

1.

A form with its method property set to GET passes its form values through the querystring. A form with its method property set to POST passes its form values through the HTTP Post headers. When passing information through the querystring, it appears in the browser's Address bar (see Figure 9.3). With the HTTP Post headers, however, the information is hidden from sight. Realize that ASP.NET Web forms use the HTTP Post header to pass form value information.

2.

Because the information is passed in the querystring, it is obvious that the form's action property was set to GET. Also, based on the values in the querystring, it can be determined that there were three form fields with the names SSN, age, and gender, and that the user entered the values 123-45-6789, 24, and M for the three form fields.

3.

Postback forms are forms whose method property is set to POST and whose action property is set to the same URL that the form exists on. That is, if the web page Page1.aspx has a postback form, its form's action property will be set to Page1.aspx.

Redirect forms are ones whose action property is set to a URL other than the URL the form exists on. That is, if the web page Page1.aspx has a redirect form, its form's action property is set to some other web page's URL, such as Page2.aspx.

(Refer to Figure 9.4 for more on the differences between postback forms and redirect forms.)

4.

ASP.NET Web Forms use postback forms.

Exercises

There are no exercises for this hour. Web forms, by themselves, are quite useless. To make Web forms useful, we need to add Web controls designed for collecting a user's input. In the next hour, "Using Text Boxes to Collect Input," we'll see how to use the TextBox Web control to collect user input. At the end of this next hour, we'll work on a number of exercises that examine the use of Web forms.




Sams Teach Yourself ASP. NET 2.0 in 24 Hours, Complete Starter Kit
Sams Teach Yourself ASP.NET 2.0 in 24 Hours, Complete Starter Kit
ISBN: 0672327384
EAN: 2147483647
Year: 2004
Pages: 233

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net