OOP Class8
Contents
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.
<%@ Page language="c#" debug="True" trace="False"%>
C# Code may be embedded in the page using script tags similar to javascript
<script language="c#" runat="server">
</script>
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 hello.aspx
http://iam.colum.edu/oop/classsource/class8/Aspx/hello2.aspx hello2.aspx
http://iam.colum.edu/oop/classsource/class8/Aspx/Label.aspx Label.aspx
In class Build three hello aspx pages similar to the ones above
Dogs on the web
Courses on the Web
Response Object
Response.Write()
http://iam.colum.edu/oop/classsource/class10/Response/Response1.aspx Response1.aspx - source
Response.End()
http://iam.colum.edu/oop/classsource/class10/Response/Response2.aspx Response2.aspx - source
Response.Clear()
http://iam.colum.edu/oop/classsource/class10/Response/ResponseClear.aspx ResponseClear.aspx - source
Response.Flush()
http://iam.colum.edu/oop/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 ResponseDebug.aspx - source
Home Work
Convert one of your classes to work as an aspx page.
Have a nice break....