designing & developing web-based solutions in asp.net

35
1 Designing & Developing Web- Based Solutions in ASP.NET Week 1

Upload: hertz

Post on 25-Feb-2016

29 views

Category:

Documents


0 download

DESCRIPTION

Designing & Developing Web-Based Solutions in ASP.NET. Week 1. Today’s Agenda. Course Overview Introductions Lab/Lecture: WebForms + Code Behind XML, web.config State Management Web Site Deployment Homework Description. Topic Schedule. Week 2Themes & Master Pages - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Designing & Developing Web-Based Solutions in ASP.NET

1

Designing & Developing Web-Based Solutions in ASP.NET

Week 1

Page 2: Designing & Developing Web-Based Solutions in ASP.NET

Today’s Agenda Course Overview Introductions Lab/Lecture:

WebForms + Code Behind XML, web.config State Management Web Site Deployment

Homework Description

Designing & Developing Web-Based Solutions in ASP.NET 2

Page 3: Designing & Developing Web-Based Solutions in ASP.NET

Topic Schedule Week 2 Themes & Master Pages Week 3 Nav, Resources, Binding, Validation Week 4 User Controls, Files, Streams Week 5 Custom Server Controls Week 6 JavaScript, AJAX, Web Services Week 7 AJAX Toolkit, WCF, JQuery Week 8 Caching & Performance Week 9 Silverlight Week 10 Special Topics, DEMOS

Designing & Developing Web-Based Solutions in ASP.NET 3

Page 4: Designing & Developing Web-Based Solutions in ASP.NET

Class Schedule 5:30-6:00 Office Hours 6:00 Review (Quiz answers) 6:15 Lecture/Lab 7:00 Break 7:10 Attendance 7:15 Lecture/Lab 8:00 Break 8:10 Assisted Lab 8:55-9:00 Assignment (posted on web)

Designing & Developing Web-Based Solutions in ASP.NET 4

Page 5: Designing & Developing Web-Based Solutions in ASP.NET

Grading 80% Attendance Required!!!

Take home quizzes 50% Reading Videos & Online Tutorials

Class Website Project 50% Implement a topic from each week 10 features required + last day 2 Minute demo

Designing & Developing Web-Based Solutions in ASP.NET 5

Page 6: Designing & Developing Web-Based Solutions in ASP.NET

Website Project Ideas Personal

Photo Album / Family Tree Interactive Resume

Small Business Employee/Client Tracker, eCommerce, Blog

Hobby Site Forum, Gadgets (special calculators)

Game / Fan Site Cards, Tic-tac-toe, Crossword, ww.Swirve.com style Sports stats, Interactive Little League Schedule

Designing & Developing Web-Based Solutions in ASP.NET 6

Page 7: Designing & Developing Web-Based Solutions in ASP.NET

Introductions - Instructor Chuck Walters Education

BS Computer Science, UW ‘95 (comp E minor) ATA: Engineering Rendering ’90 (drafting & CAD) A&P: Airframe Mechanics ’89

Companies Electronic Arts, Wizards of the Coast, Tooned In,

Manley and Associates, Tektronix, Attachmate, The Whole Experience, Microsoft, Digini, Gamegineer

Designing & Developing Web-Based Solutions in ASP.NET 7

Page 8: Designing & Developing Web-Based Solutions in ASP.NET

Introductions - Instructor C/C++/Asm

Games: Racing, FPS, Sports, … C# Projects

Game dev support tools, Magic the Gathering Online, Video Conferencing, Cribbage in Silverlight

Cell Brew arcade game, ProteinFolder cell web site

Web JNI, Swing, Java script, server monitors, …

Designing & Developing Web-Based Solutions in ASP.NET 8

Page 9: Designing & Developing Web-Based Solutions in ASP.NET

Shipped Titles

Designing & Developing Web-Based Solutions in ASP.NET 9

Page 10: Designing & Developing Web-Based Solutions in ASP.NET

Introductions – Students (2 min) Name Background (Education – Work)

Reason Attending Personal - work Most Interesting Topic

Web Site Project Idea

Designing & Developing Web-Based Solutions in ASP.NET 10

Page 11: Designing & Developing Web-Based Solutions in ASP.NET

BASIC XML

Designing & Developing Web-Based Solutions in ASP.NET 11

Page 12: Designing & Developing Web-Based Solutions in ASP.NET

XML Formatted Files Files formatted in XML

HTML WebForms

.aspx .ascx

web.config <MyMasterPage>.master

Designing & Developing Web-Based Solutions in ASP.NET 12

Page 13: Designing & Developing Web-Based Solutions in ASP.NET

XML –Samples <Client></Client> // Begin & End <Client/> // Empty Node <Client Name=“Joe”/> // Attr only - Shortcut <!--Client></Client--> // Comment Out <Client Name=“Joe”> // Override if Attr set

<Name>Joe</Name> // Element of Client -// Default Format

<Address/> // empty, can remove with// XML, stays w/

SOAP</Client> Designing & Developing Web-Based Solutions in ASP.NET 13

Page 14: Designing & Developing Web-Based Solutions in ASP.NET

WEB FORMSAnatomy Review

Designing & Developing Web-Based Solutions in ASP.NET 14

Page 15: Designing & Developing Web-Based Solutions in ASP.NET

WebForms – The Basics WebForm + Code Behind

Webform xml template used to construct html page

CodeBehind Uses webform to render html page Handle events on the server

Filenames Webform = *.aspx Codebehind = *.aspx.cs

Designing & Developing Web-Based Solutions in ASP.NET 15

Page 16: Designing & Developing Web-Based Solutions in ASP.NET

WebForm – Page Directive Page Directive

<% Page Language=“C#” CodeFile=“default.aspx.cs”AutoEventWireup=“true”Trace=“true” // On page debugging%>

Comments <%-- This is a comment --%> // different than xml

Designing & Developing Web-Based Solutions in ASP.NET 16

Page 17: Designing & Developing Web-Based Solutions in ASP.NET

WebForm - DocType <!DOCTYPE html PUBLIC "-//W3C//DTD

XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Browser Compatibility Features Compatibility Deprecated features XHTML compliance

Designing & Developing Web-Based Solutions in ASP.NET 17

Page 18: Designing & Developing Web-Based Solutions in ASP.NET

WebForm - Content HTML

<head> <body> <form> <div> <br>

ASP.NET controls <asp:Label> <asp:Content> // Used with master pages

Designing & Developing Web-Based Solutions in ASP.NET 18

Page 19: Designing & Developing Web-Based Solutions in ASP.NET

WebForm – Page Class Response Object

Query String Cookies URL entered Client Browser Specs Much More (Look at this in debugger)

State Objects View, Session, Application, Cache

User Object Covered next quarter (profiles, roles, security)

Designing & Developing Web-Based Solutions in ASP.NET 19

Page 20: Designing & Developing Web-Based Solutions in ASP.NET

EVENTSCode Behind

Designing & Developing Web-Based Solutions in ASP.NET 20

Page 21: Designing & Developing Web-Based Solutions in ASP.NET

Events Page

Init Load/Loaded

Also called on postback PreRender/Render Unload

Postback Events OnChanged OnClicked …

Designing & Developing Web-Based Solutions in ASP.NET 21

Page 22: Designing & Developing Web-Based Solutions in ASP.NET

SERVER CONTROLSBasic Intro

Designing & Developing Web-Based Solutions in ASP.NET 22

Page 23: Designing & Developing Web-Based Solutions in ASP.NET

Server Controls

Designing & Developing Web-Based Solutions in ASP.NET 23

Definition: runat=“server”

Basic Types HTML Controls (Simple wrap) Web Controls (Enhanced wrap) Rich Controls (Limited use custom controls) Validation Controls

Page 24: Designing & Developing Web-Based Solutions in ASP.NET

STATE MANAGEMENTReview

Designing & Developing Web-Based Solutions in ASP.NET 24

Page 25: Designing & Developing Web-Based Solutions in ASP.NET

State ManagementQuery String View State Cookie Session State App State

Deprecated Profiles Caching

Data String Serializable Strings All All Serializable All

LocationBrowser’s URL

Hidden field current page

ClientDisk or Memory

Server memory or database

Server memory

Server database

Server memory

LifetimeURL Browser Settable

Disk 0 - ∞Tunable Server

RebootPermanent Tunable

ScopePage Page, gone

when nav away

App Single User entire Site

All users on entire Site

Anything All users on entire Site

SecurityNo Encryption

supportNo Server

Client SentServer Server Server

PerformFAST!!!Limited Len

Slows with size - unbound

FAST!!!Limited Len

Bloat with # of users

Bloat Handles large data.Overhead

Tunable

UseProduct ID’s Temp page

settingsUser Preferences

Shopping cart

Global data Account Info

Database data

Designing & Developing Web-Based Solutions in ASP.NET 25

Page 26: Designing & Developing Web-Based Solutions in ASP.NET

State Management – Accessors Common Get/Set design pattern

<State Type>[“Key”] Examples

ViewState[“myData”] = 1234; // Any Data TypeSession[“myData”] = 1234; // Any Data Type HttpCookie userPrefs =

Response.Cookies[“cookieName”]; String productName =

Request.QueryString[“product”];

Designing & Developing Web-Based Solutions in ASP.NET 26

Page 27: Designing & Developing Web-Based Solutions in ASP.NET

State Management – ViewState Access

ViewState[someControl.ID] Controls automatically stored by ID (which is a string)

Stored as global base type: System.Object ViewState[“LuckyNum”] = 1234; // object array int luckyNum = (int)ViewState[“LuckyNum”]; // Cast

Enabled by default <%@ Page EnableViewState=“false” %>

Encryption off by default <%@ Page ViewStateEncryptionMode=“Always” %>

Designing & Developing Web-Based Solutions in ASP.NET 27

Page 28: Designing & Developing Web-Based Solutions in ASP.NET

State Management – Query Str Format

Key / Value Element Access

Use Redirection Simple State

Login Name Product IDs Action

Designing & Developing Web-Based Solutions in ASP.NET 28

Page 29: Designing & Developing Web-Based Solutions in ASP.NET

State Management - Cookies Lifetime settings On Disk or In Memory Compact setting Dealing with Disabled Cookies

Designing & Developing Web-Based Solutions in ASP.NET 29

Page 30: Designing & Developing Web-Based Solutions in ASP.NET

WEB SITE DEPLOYMENTOverview

Designing & Developing Web-Based Solutions in ASP.NET 30

Page 31: Designing & Developing Web-Based Solutions in ASP.NET

Website Deployment Location

FTP (preferred) Local IIS FrontPage Extensions

Multi-Site Virtual Directories Redirect (performance hit)

Designing & Developing Web-Based Solutions in ASP.NET 31

Page 32: Designing & Developing Web-Based Solutions in ASP.NET

Website Deployment - Admin Domain Redirect

DNS1, DNS2, DNS… Permissions

Browsable directory Password protected

Designing & Developing Web-Based Solutions in ASP.NET 32

Page 33: Designing & Developing Web-Based Solutions in ASP.NET

LABHands On

Designing & Developing Web-Based Solutions in ASP.NET 33

Page 34: Designing & Developing Web-Based Solutions in ASP.NET

Lab Create a simple site

View files Web.config .aspx + codebehind + partial class (maintained by VS)

Debug Events Add Server Controls

Deploy site Set Trace on (per page) Custom Errors off (web.config)

View web host controls (webhost4life.com)

Designing & Developing Web-Based Solutions in ASP.NET 34

Page 35: Designing & Developing Web-Based Solutions in ASP.NET

Homework Readings

Chapter 16 – Themes & Master Pages Reading Quiz due beginning of next class Review if needed (Ch 3 – Web Forms, Ch 6 – State)

Project Assignment Signup for webhosting

WebHost4Life.com $10 / month Signup for domain (optional yet recommended)

www.mydomain.com < $9 / year “Website Project” idea.

Write up simple page hierarchy & content

Designing & Developing Web-Based Solutions in ASP.NET 35