HTML Forms
Http is a staless protocol. There is mo mechanism built in to the protocol that allows the server to remeber clients or requests. An http simply responds to http verbs GET, POST, PUT, DEL, TRACE etc. contained in RFC 2068 HTTP/1.1
Old html forms post information using forms in 2 ways with a get or a post http request.
Get
- Get send information to the server using the URI. Limited to 1024 character in some browsers and servers.
Example
http://iam.colum.edu/oop/classsource/class9/simpleGet.html simpleGet.html - source
The simpleGet.html pages form has the action of 'simpleGet.aspx' this mean that when the form is submitted the browser will request the 'simpleGet.aspx' with whatever parameters are in the form.
Since the method = get theese prarmenters will show up are query string parameters
URI and querystring parameters
URI - Universal Resource Identifier http://src.doc.ic.ac.uk/computing/internet/rfc/rfc1630.txt RFC1630
Http URI
Protcol | Host | Port | Path | File | Fragment identifier | Querystring |
http:// | info.cern.ch | :8000 | /imaginary/test/ | file.html | #link | ?test=yes |
Post
- Post posts the varibles in the HTTP Header.
Example
http://iam.colum.edu/oop/classsource/class9/simplePost.html simplePost.html - source
FirstName:
LastName:
Header Name Value HttpMethod GET
Connection keep-alive
Keep-Alive 300
Accept text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Encoding gzip,deflate
Accept-Language en-us,en;q=0.5
Cookie ASP.NET_SessionId=ezfgw255ix0zd5yogj3eawej
Host imdev
Referer http://imdev/infod/jeff/
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1
HTML Forms
Example HTML Forms
http://iam.colum.edu/oop/classsource/class9/htmlForms.html htmlForms.html - source
Web Forms
Examples of Web Forms
http://iam.colum.edu/oop/classsource/class9/aspForms.aspx aspForms.aspx - Source
todo examples of all the html elements and how they react to form submits
Persiting Data
POST and GET
an asps page posting to itself
todo demostate viewstate
Sessions
Dog examples
The first page creates a dog objects and stores it as a session variable.
http://iam.colum.edu/oop/classsource/class9/dogsession/dog.aspx dog.aspx - source
http://iam.colum.edu/oop/classsource/class9/dogsession/dog_session_Page1.aspx dog_session_Page1.aspx - source
http://iam.colum.edu/oop/classsource/class9/dogsession/dog_session_Page2.aspx dog_session_Page2.aspx - source
http://iam.colum.edu/oop/classsource/class9/dogsession/dog_session_Page3.aspx dog_session_Page3.aspx - source
Delgates
Events in c#
Event handlers
OnClick
http://iam.colum.edu/oop/classsource/class9/events/events1.aspx
events1.aspx - source
OnCommand
http://iam.colum.edu/oop/classsource/class9/events/events2.aspx
events2.aspx - source
http://iam.colum.edu/oop/classsource/class9/events/events3.aspx
events3.aspx - source
Home Work
Make an post an catch aspx page with a form of your very own that asks questions about one of your objects.
Use the form values to create a new instance of your class.
Get and read Intro and Chapter 1 of Head Start Design Patterns