Introduction to ASP.NET
Microsoft Corporation
What We Will Cover
Introduction to Microsoft® .NET “Classic” ASP Microsoft® ASP.NET Server controls Data controls ASP.NET Web applications Business objects Web services Additional topics
Session Prerequisites
This session assumes that you understand the fundamentals of
Development on Microsoft® Windows® ASP or Microsoft® Visual Basic®
This is a Level 100 Session
So Why This Presentation? ASP.NET
offers many enhancements over classic ASP but… With ASP.NET, there’s a lot new to learn Solves many ASP issues RAD for the Web
Demonstrations
ASP vs. ASP.NET Server controls walk-through Validation Data controls Cookieless sessions Web services Page caching
Agenda
Introduction to .NET “Classic” ASP ASP.NET Server controls Data controls ASP.NET Web applications Business objects Web services Additional topics
Introduction to .NET 1st Generation
Cli ent Lo gic
Se rv ers Da ta , Ho st s
Biz Log ic Bro ws er s
Web app developers took advantage of these local services and used HTML to “project” the UI to many types of clients Microsoft provided COM, IIS, Internet Explorer
OS Se rv ices Applications largely operating in a client / server model were augmented with Web browser and servers. The industry focused on rich OS and local services provided by products like SQL Server™.
Introduction to .NET 2nd Generation Ri ch Cli ent Lo gic
Bro ws er s
Biz Tie r L ogic
OS Se rv ices
COM+ Services improve reliability, scalability and manageability. Internet Explorer provides DHTML for better interactivity. Combination of “stateless” Web protocols with DNS and IP routing have enabled mass-scale “geo-scalability”
Se rv ers Da ta , Ho st s
“ Sta tef ul” “ Sta teles s” & “ Geo -Sc alable
Separation of data and business logic provide greater scalability and performance while accessing enterprise and legacy data.
Introduction to .NET
Web Services: The Next Generation Othe r Se rv ice s Sma rt er Cli ent s St an da rd Br ows ers
Appl ic at ions Become Program mabl e Web Servic es
XM L XM L
HTM L XM L
Bi z Biz Lo gic & Web rv ice Tie r LSeogic
OS OS Se Se rv rv ice ice ss
XML
Pu blic W eb Se rv ices
XM L
Bu il ding Blo ck Se rv ice s
XM L
Int ern al Se rv ic es
XM L Sma rt er Se rv er s Ope n Int ern et Dev ice s Dat a, Hos ts Com mun icatio ns Pro toc ols Ric he r, Mo re Ap plic at ions (HTTP, SM TP, XML , SO AP) Pr od uct ive Us er Lev era ge Ex pe rien ce Globall y-A va il able
Introduction to .NET
Web Services: The Next Generation Othe r Se rv ice s Sma rt er Cli ent s St an da rd Br ows ers
Appl ic at ions Become Program mabl e Web Servic es
XM L XM L
HTM L XM L
Bi z Biz Lo gic & Web rv ice Tie r LSeogic
OS OS Se Se rv rv ice ice ss
XML
Pu blic W eb Se rv ices
XM L
Bu il ding Blo ck Se rv ice s
XM L
Int ern al Se rv ic es
XM L Sma rt er Se rv er s Ope n Int ern et Dev ice s Dat a, Hos ts Com mun icatio ns Pro toc ols Ric he r, Mo re Ap plic at ions (HTTP, SM TP, XML , SO AP) Pr od uct ive Us er Lev era ge Ex pe rien ce Globall y-A va il able
Introduction to .NET The .Net Platform Vi sual Studi o ® .NET
Your Application and Web Service
Applications Using Your Service End-User Clients
.NET Framework
Operati on s
Orchestration
Windows CE, 2000, XP, .NET ®
Internet Prot oc ols SOAP “bl ue book” HT TP, SMT P, XML
Your Internal Services .NET Ent er pri se Serv ers .NE T Foun dat ion Ser vices 3 rd Part y We b Serv ices
Introduction to .NET
The .NET Framework and Visual Studio .NET Visual Basic® C++ C# JScript® …
ASP.NET: Web Services and Web Forms
Windows Forms
ADO.NET: Data and XML Base Class Library Common Language Runtime
Visual Studio .NET
Common Language Specification
Introduction to .NET ASP.NET
Visual Basic® C++ C# JScript® …
ASP.NET: Web Services and Web Forms
Windows Forms
ADO.NET: Data and XML Base Class Library Common Language Runtime
Visual Studio.NET
Common Language Specification
Agenda
Introduction to .NET ASP today ASP.NET Server controls Data controls ASP.NET Web applications Business objects Web services Additional topics
“Classic” ASP Successes
Simple procedural programming model Access to COM Objects
ADO File system object
No compiling, just save Support for multiple scripting languages Mix HTML and code VBscript – leverage Visual Basic skills
“Classic” ASP Challenges
Code readability Coding overhead PostBack complexity Reuse Performance DLL locking Deployment Sessions Caching
“Classic” ASP Challenges
Code readability Coding overhead PostBack complexity Reuse Performance DLL locking Deployment Sessions Caching
Agenda
Introduction to .NET “Classic” ASP ASP.NET Server controls Data controls ASP.NET Web applications Business objects Web services Additional topics
ASP.NET
Architecture ASPX
.ASPX
ASP.NET
Architecture
Compiled
.ASPX
ASP.NET
Architecture
Compiled
.ASPX
ASP.NET
Architecture
Compiled
.ASPX
ASP.NET
Execution Model Source code Managed code
Visual Basic
C#
C++
Compiler
Compiler
Compiler
Assembly IL Code
Assembly IL Code
Assembly IL Code
Common Language Runtime JIT Compiler Native Code
Operating System Services
Unmanaged Component
ASP.NET
Execution Model Source code Managed code
Visual Basic
C#
C++
Compiler
Compiler
Compiler
Assembly IL Code
Assembly IL Code
Assembly IL Code
Common Language Runtime JIT Compiler Native Code
Operating System Services
Unmanaged Component
ASP.NET Features
ASPX, ASP – side by side Simplified programming model Simplified deployment Better performance Caching Security Powerful controls
ASP.NET Features
Simplified browser support Simplified form validation Code behind pages More powerful data access Web services Better session management
ASP.NET Features
No DLL locking No DLL registration Simplified configuration Pagelets
Demonstration 1 ASP vs. ASP.NET
Data-Driven ASP Data-Driven ASP.NET Comparison
Agenda
Introduction to .NET “Classic” ASP ASP.NET Server controls Data controls ASP.NET Web applications Business objects Web services Additional topics
Server Controls
Simplify Common Tasks
Simplify common tasks
Forms Tables Data display Calendar Ad rotator
Server-side programming model Automatic browser compatibility Less code, less complexity Extensible
Server Controls
HTML and Server Controls
ID – uniquely identifies control Runat – enables server-side processing OnClick – identifies server-side event handler
Server Controls Forms
<script language="C#" runat=server> void SubmitBtn_Click(Object sender, EventArgs e) { Response.Write (“Hello” + txtUserName.Text); }
PostBack
Server-side object automatically populated from client-side controls
Server Controls Browser Support
Targets client on the fly
Style Font
Validation
Client-side Server-side
Demonstration 2 Server Controls Walk-Through Programming Model Syntax
Server Controls Validation
Without code
Required field Within range Two fields equal (password) Regular expressions Validation error messages
With code, but simplified
Custom validation
Demonstration 3 Validation
Required Field Validation Summary
Agenda
Introduction to .NET “Classic” ASP ASP.NET Server controls Data controls ASP.NET Web applications Business objects Web services Additional topics
Data Controls
Bind to many data sources
Collections
ADO.NET
Array HashTable DataReader DataSet
XML
Data Controls ADO.NET
Connection Command DataReader DataSet DataAdapter DataView
Data Controls ADO.NET
DataSet
Database
Authors
Connection DataAdapter Select … from Authors
Authors
Data Controls ADO.NET
DataSet
Database
Authors
Connection Publishers
DataAdapter Select … from Publishers
Publishers
Data Controls ADO.NET
DataSet
DataGrid
Authors
Repeater Publishers
DataList
DataView
Data Controls DataGrid
Displays data as a table Control over
Alternate item Header Footer Colors, font, borders, etc. Paging
Updateable Item as row
Data Controls Repeater
List format No default output More control More complexity Item as row Not updateable
Data Controls DataList
Directional rendering Good for columns Item as cell Alternate item Updateable
Demonstration 4 Data Controls ADO.NET DataGrid Repeater DataList
Agenda
Introduction to .NET “Classic” ASP ASP.NET Server controls Data controls ASP.NET Web applications Business objects Web services Additional topics
ASP.NET Web Applications
Global ASAX
Application_Start Application_End Session_Start Session_End
Session Application
ASP.NET Web Applications web.config
Site configuration file Like an .INI file for your site XML format Extensible Some settings
Security Session Localization Tracing Debugging
ASP.NET Web Applications Session Variables
Store state information No longer require cookies Share between servers
<sessionState
/>
mode=“StateServer“ stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;user id=sa;password=" cookieless="false" timeout="20"
Demonstration 5
Cookieless Sessions Sessions with cookies web.config Sessions without cookies
Agenda
Introduction to .NET “Classic” ASP ASP.NET Server controls Data controls ASP.NET Web applications Business objects Web services Additional topics
Business Objects
Problems with ASP and DLLs DLLs with .NET
Business Objects
Problems with ASP and DLLs
DLL Locking
MTS/COM+
Page hit Shutdown Web application Shutdown Internet Information Server Edit in Visual Interdev Shutdown package Binary compatibility
Registry
Business Objects DLLs with .NET
Not registered
Placed in ./bin directory
Not locked
Shadow copy
Agenda
Introduction to .NET “Classic” ASP ASP.NET Server controls Data controls ASP.NET Web applications Business objects Web services Additional topics
Web Services
The Web today How Web services work
Web Services The Web Today
Purchase courseware Purchased
Designed for people to browse
Web Services The Web Today
Purchase Courseware
?
Server to server is a problem
Web Services
What Are Web Services?
Allow applications to communicate across the Internet Platform independent Protocol independent Synchronous/asynchronous Stateful/stateless BizTalk® ASP.NET
Web Services Class Courseware WebMethod GetPrice Purchase
.ASMX
Web Services Testing Courseware.asmx Test HTML Page
.ASMX
Web Services WSDL Courseware.asmx?WSDL Service Definition(XML)
Proxy DLL
.ASMX
Web Services Register for Course Purchase Courseware
Proxy DLL
.ASMX
Demonstration 6 Web Services
Web Service Source Testing WSDL Client Proxy Creation Consuming a Web Service
Agenda
Introduction to .NET “Classic” ASP ASP.NET Server controls Data controls ASP.NET Web applications Business objects Web services Additional topics
Additional Topics
Deployment Scalability Caching Authentication and authorization Availability
Additional Topics Deployment
Copy
Apps are isolated
Components in .\bin No registering DLLs No locked DLLs Each app can have its own version
Uninstall
Delete
Additional Topics
Scalability Improvements
ASP.NET pages are complied State shared across machines Managed providers Disconnected data access Caching
Additional Topics Caching
Page output caching <%@ OutputCache Duration="60" VaryByParam="none" %>
Page data caching Cache[“MyDataSet”] = SomeDataSet
Like application variables Scavenging Expiration Dependencies
Additional Topics Authentication
Supports basic, digest, cookie, and Windows authentication, Passport Form-based authentication Users or roles One API for user info
Demonstration 7 Page Caching
Compare Performance
Call To Action
Download the .NET Framework SDK Build a new ASP.NET application, or migrate from ASP
Session Summary
ASP.NET offers many enhancements
Improved session state Improved programming model Validators Caching In-place updating of sites The list goes on…
For More Information…
MSDN Web site at
msdn.microsoft.com msdn.microsoft.com/net
C# Language Reference
msdn.microsoft.com/library/prelim/csref/vc oricreference.htm
For More Information…
.NET Resources/Quickstart Tutorials
http://www.gotdotnet.com
MSDN
Essential Resources for Developers Subscription Services
Library, OS, Professional, Enterprise, Universal Delivered via CD-ROM, DVD, Web
Online Information
MSDN Online, MSDN Flash, How-To Resources, Download Center
Training & Events
MSDN Webcasts, MSDN Online Seminars, Tech-Ed, PDC, Developer Days
Print Publications
MSDN Magazine MSDN News
Membership Programs
MSDN User Groups
How-To Resources
Simple, Step-By-Step Procedures
Embedded development how-to resources General how-to resources Integration how-to resources Jscript® .NET how-to resources .NET development how-to resources Office development resources Security how-to resources Visual Basic® .NET how-to resources Visual C#™ .NET how-to resources Visual Studio® .NET how-to resources Web development how-to resources (ASP, IIS, XML) Web services how-to resources Windows development how-to resources
MSDN Webcasts
Interactive, Live Online Events
Interactive, synchronous, live online events Discuss the hottest topics from Microsoft Open and free for the general public Take place every Tuesday http://www.microsoft.com/usa/webcasts
MSDN Subscriptions
The way to get Visual Studio .NET Visual Studio .NET
MSDN Subscriptions MSDN Universal $2799 new $2299 renewal/upgrade
Enterprise Developer • Enterprise lifecycle tools • Team development support • Core .NET Enterprise Servers
MSDN Enterprise $2199 new $1599 renewal/upgrade
Professional • Tools to build applications and XML Web services for Windows and the Web
MSDN Professional $1199 new $899 renewal/upgrade
NEW
Enterprise Architect • Software and data modeling • Enterprise templates • Architectural guidance
Where Can I Get MSDN?
Visit MSDN Online at msdn.microsoft.com Register for the MSDN Flash e-mail newsletter at msdn.microsoft.com/flash Become an MSDN CD subscriber at msdn.microsoft.com/subscriptions MSDN online seminars msdn.microsoft.com/training/seminars Attend more MSDN events
Microsoft Press®
Essential Resources for Developers
Microsoft® Visual Studio® .NET is here! This is your chance to start building the next big thing. Develop your .NET skills, increase your productivity with .NET Books from Microsoft Press.
www.microsoft.com/mspress
Become a Microsoft Certified Solution Developer
What is MCSD?
How do I attain MCSD certification?
Premium certification for professionals who design and develop custom business solutions It requires passing four exams to prove competency with Microsoft solution architecture, desktop applications, distributed application development, and development tools
Where do I get more information?
For more information about certification requirements, exams, and training options, visit www.microsoft.com/mcp
Training
Training Resources for Developers Introduction
to ASP.NET
Course
no. 2063 Detailed syllabus: www.microsoft.com/traincert To locate a training provider for this course, please access
www.microsoft.com/traincert Microsoft Certified Technical Education Centers are Microsoft’s premier partners for training services