Title: Building Effective Web Applications with ASP .Net 3.5
1Building Effective Web Applications with ASP .Net
3.5
- Nor Azhar Ahmad
- Universiti Malaysia Pahang
- BCS2203
- Web Application Development
2Target Audience
- Prior web development experience
- Best geared towards programmers, software
engineers, web designers, technical leads, task
leads and architects. - Class will be taught using C which has a similar
syntax to Java
3Course Objectives
- Become familiar with new features in ASP .Net 3.5
- Build database driven apps using LINQ
- Leverage ASP .Net AJAX on both the client and
server side - Learn about state management and caching
- Secure your ASP .Net websites
- Create an end to end web app
4Todays Agenda Getting Started
- Tools We Will Use
- ASP .Net 3.5 Overview
- Project Setup/Configuration
- WebForms Overview
- Server Controls
- User Controls
- Master Pages
- Debugging and Tracing
- New Features in ASP .Net 3.5
5ASP .Net 3.5 Overview
- ASP .Net 3.5 is a technology that allows
programmers to create dynamic web sites. - ASP .Net can be used to create small personal web
sites or Enterprise applications - ASP .Net is part of the .Net Framework
- .Net Framework consists of the Framework Class
Library and the Common Language Runtime
6Tools We Will Use
- VS 2008 Professional or
- Visual Web Developer 2008
- SQL Server Express Edition or higher (2005 or
2008) - Express Edition or higher
- Links to download these products can be found on
http//msdn.microsoft.com - VS2008 available from MS, MSDN or Team System
subscription or contact Bill Scherer Jr (SRA
Enterprise Solutions Tech Director)
7Working with .Net Projects VS2003
- VS2003 Single solution file. Project
precompiled into a single DLL, ASPX markup pages
deployed. - Pros
- Compiles/debugs like other projects (WinForms,
etc.) - Slightly more efficient.
- Single file deployment referenced DLLs HTML.
- Cons
- Not easy to use in team environments.
- Often leads to monolithic DLLs for large sites.
8Working with Projects - VS2005
VS2005 Website Compilation Model All files
compiled on demand. Pros Works better in
teams. Easy to deploy/test incremental
updates. Cons Can be difficult to upgrade from
VS2003. First hit incurs compilation
overhead. May mean more files to deploy.
9Working with Projects - VS2008
- VS2008 Both models supported out of the box.
-
File -gt New -gt Web Site
File -gt New -gt Web Site
File -gt New -gt Project -gt ASP.NET Web App
New style
New style
New style
Old style
10Demo
- Create a new website using ASP .Net 3.5 and
VS2008
11Web Forms Key Points
- ASPX pages handled by a handler that facilitate
the page lifecycle and events (such as Page_Load,
PreRender, and control events). - Uses ViewState to encoded state-specific
information otherwise lost in the stateless
nature of HTTP. - Extensive controls library to abstract
functionality. Buttons, textboxes, etc. - Extensible.
- Web Forms have a .aspx file extension.
12Server Controls
- Typically compiled into a DLL.
- Represents a small piece of functionality, like a
textbox or button. - Responsible for handling any special rendering
requirements, raising events, etc.
Event Handlers
Properties
13User Controls
- Collections of HTML and/or Server Controls for a
broader purpose such as a login dialog box. - Typically part of a project and compiled with the
project. - Can expose properties.
14HTML Controls
- Take any HTML tag and add a runatserver tag.
- This converts the HTML tag into a server-side ASP
.Net control - Allow us to program server side events
15Master Pages
- Same look and feel to many pages code in one
spot.
16Break
- We will look at some other Demos after break
17ViewState (p29)
- The HTTP Protocol is a stateless protocol
- Web Pages use a Request/Response model
- ViewState allows us to save the state of a server
control across multiple page requests - Comes with performance overhead
- Enabled by default for each control
18Demo
- Add page level tracing to existing page
- Examine page lifecycle
- Examine Viewstate cost
- Write to trace log
- We can determine if the page is posting back by
using the Page.IsPostback property - We can turn tracing and debugging on at the page
or app level
19Dynamic Compilation (p35)
- When we create an ASP .Net page we are creating
source code for a .Net class - Pages are compiled and stored in a temp folder on
the web server - Unlike classic ASP the page will not be
recompiled again, unless we disable dynamic
compilation - This allows support for thousands of simultaneous
users
20Code Behind vs Single File Pages
- In a single file ASP .Net page, a single file
contains both the page code and page controls - A code behind has the page code in a separate
file - Which should you use? (p45)
21New Features of VS2008
- Javascript Intellisense/Debugging support
- Nested Master Pages
- Enhanced CSS Management
- Multi-targeting support.
- New data controls.
- MUCH improved designer.
22Other ASP .Net Resources
- MSDN Web site
- Sra.skillport.com
- MSDN Virtual Labs
- MS Tech-ED Developer presentations on my SRA
portal site - VS 2008 Training Kit
- http//www.asp.net/downloads/
- http//www.codeplex.com/aspnet