Difference between revisions of "OOP Class8"

esse quam videri
Jump to: navigation, search
(Dogs on the web)
 
(29 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:OOP]]
+
[[Category:IAM Classes]]
 
+
MIDTERM
 
 
 
 
==Motorvehicle Diagram==
 
 
 
[[Oop Motorvehicle Diagram]]
 
 
 
http://iam.colum.edu/oop/browser/browser.aspx?f=/classsource/class7/Motor
 
 
 
==Anatomy of an aspx page==
 
'''Page Directive'''
 
The page directive must be on the first line of an aspx page. It consists of Name/Value Pairs and sets parameters that will be used throughout the execution of the page ie. the language.
 
 
 
<code>
 
<%@ Page language="c#" debug="True" trace="False"%>
 
</code>
 
 
 
C# Code may be embedded in the page using script tags similar to javascript
 
 
 
<code>
 
<script language="c#" runat="server">
 
</script>
 
</code>
 
 
 
Notice the runat attribute is set to 'server'. This is what makes the code execute on the server rather than be parsed by the client.
 
 
 
Console applications start executing in the main method
 
 
 
<csharp>public static void Main() {}</csharp>
 
 
 
The .Net Framework can also execute on the web. Rather than having a Main method a web page starts it's execution with a method called Page_Load
 
 
 
<csharp>public Page_Load { }</csharp>
 
 
 
There are actually several method that are executed in an aspx page.
 
 
 
http://samples.gotdotnet.com/quickstart/aspplus/
 
 
 
==Simple Aspx Page==
 
 
 
http://iam.colum.edu/oop/classsource/class8/Aspx/hello.aspx [http://iam.colum.edu/oop/gbrowser.php?file=/classsource/class8/Aspx/hello.aspx hello.aspx]
 
 
 
http://iam.colum.edu/oop/classsource/class8/Aspx/hello2.aspx
 
[http://iam.colum.edu/oop/gbrowser.php?file=/classsource/class8/Aspx/hello2.aspx hello2.aspx]
 
 
 
http://iam.colum.edu/oop/classsource/class8/Aspx/Label.aspx
 
[http://iam.colum.edu/oop/gbrowser.php?file=/classsource/class8/Aspx/Label.aspx Label.aspx]
 
 
 
In class
 
Build three hello aspx pages similar to the ones above
 
 
 
==Dogs on the web==
 
[http://iam.colum.edu/oop/browser/browser.aspx?f=/classsource/class8/DogWeb DogWeb]
 
 
 
==HTML Forms==
 
 
 
Http is a stateless 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 [http://www.faqs.org/rfcs/rfc2068.html 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 [http://iam.colum.edu/oop/gbrowser.php?file=/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 these pararmeters 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
 
<table border="1">
 
 
 
<th>Protcol</th><th>Host</th><th>Port</th><th>Path</th><th>File</th><th>Fragment identifier</th><th>Querystring</th>
 
 
 
 
 
<tr>
 
<td>http://</td><td>info.cern.ch</td><td>:8000</td><td>/imaginary/test/</td><td>file.html</td><td>#link</td><td>?test=yes</td>
 
</tr>
 
<table>
 
 
 
Post
 
:Post posts the variables in the HTTP Header.
 
 
 
 
 
 
 
Example
 
http://iam.colum.edu/oop/classsource/class9/simplePost.html [http://iam.colum.edu/oop/gbrowser.php?file=/classsource/class9/simplePost.html simplePost.html - source]
 
 
<pre>
 
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
 
</pre>
 
 
 
HTML Forms
 
Example HTML Forms
 
 
 
http://iam.colum.edu/oop/classsource/class9/htmlForms.html [http://iam.colum.edu/oop/gbrowser.php?file=/classsource/class9/htmlForms.html htmlForms.html - source]
 
 
 
==Courses on the Web==
 
[http://iam.colum.edu/oop/browser/browser.aspx?f=/classsource/class8/StudentWeb Student Web]
 
 
 
==Response Object==
 
 
 
Response.Write()
 
 
 
http://iam.colum.edu/oop/classsource/class10/Response/Response1.aspx
 
[http://iam.colum.edu/oop/gbrowser.php?file=/classsource/class10/Response/Response1.aspx Response1.aspx - source]
 
 
 
Response.End()
 
 
 
http://iam.colum.edu/oop/classsource/class10/Response/Response2.aspx
 
[http://iam.colum.edu/oop/gbrowser.php?file=/classsource/class10/Response/Response2.aspx Response2.aspx - source]
 
 
 
Response.Clear()
 
 
 
http://iam.colum.edu/oop/classsource/class10/Response/ResponseClear.aspx
 
[http://iam.colum.edu/oop/gbrowser.php?file=/classsource/class10/Response/ResponseClear.aspx ResponseClear.aspx - source]
 
 
 
Response.Flush()
 
 
 
http://iam.colum.edu/oop/classsource/class10/Response/ResponseFlush.aspx
 
[http://iam.colum.edu/oop/gbrowser.php?file=/classsource/class10/Response/ResponseFlush.aspx ResponseFlush.aspx - source]
 
 
 
 
 
===Debugging with response object===
 
 
 
Using the response buffer can be extreemely usefull for debugging. Sometime you may have to setup a small debug system to help catch errors in object that do not inherit from System.UI.Page.
 
 
 
Response.Flush()
 
 
 
http://iam.colum.edu/oop/classsource/class10/Response/ResponseDebug.aspx
 
[http://iam.colum.edu/oop/gbrowser.php?file=/classsource/class10/Response/ResponseDebug.aspx ResponseDebug.aspx - source]
 
 
 
==Home Work==
 
 
 
Convert one of your classes to work as an aspx page.
 
 
 
Have a nice break....
 

Latest revision as of 16:31, 10 June 2019

MIDTERM