You are on page 1of 38

An Introduction to .

NET
ASP.NET
http://sdetu/courses/sdetc101/
Lecture 04
Thursday, February 14, 2008
Agenda

• Quick recap…

• Introduction to .NET

• Introduction to ASP.NET

14 Feb 2008 ASP.NET 2


Introduction to .NET

.NET ?

Business strategy from Microsoft to converge personal


computing with the web.

14 Feb 2008 ASP.NET 3


What is a framework?

 A set of software routines that provide a foundation structure

for an application.

 Frameworks take the tedium out of writing an application

from scratch.

 Object-oriented application frameworks, which are the norm

today, are structured as a class library.

14 Feb 2008 ASP.NET 4


.NET Framework

.NET + Framework = .NET Framework

It is an environment for building, deploying, running web


services and other applications.

14 Feb 2008 ASP.NET 5


Objective of .NET Framework

 To provide consistent Object Oriented programming

environment.

 Provide code execution environment:


• Which reduces security flaws.

• Which reduces version conflicts.

• Which increases performance of application.

• Which can be used for widely varying types of applications, such as


Windows-based applications and Web-based applications.

14 Feb 2008 ASP.NET 6


What is .NET Framework made up of?

 The class Libraries which take out tedium in developers work.

 The Common Language Runtime which manages the code which is

executing.

• Memory Management.

• Thread Management.

• Exception handling.

• Garbage collection

• Security

14 Feb 2008 ASP.NET 7


What is .NET Framework?

The middle – man

.NET Application

.NET Framework

Operating System + Hardware

14 Feb 2008 ASP.NET 8


.NET Frameworkommon Language Runtime

• CLR manages code execution at runtime


• Memory management, thread management, etc.
• Code-based security
• Role-based security

Common Language Runtime

Operating System
14 Feb 2008 ASP.NET 9
.NET Frameworkase Class Library

• Object-oriented collection of reusable types


• Collections, I/O, Strings, …

.NET Framework (Base Class Library)

Common Language Runtime

Operating System
14 Feb 2008 ASP.NET 10
.NET Frameworkta Access Layer
• Access relational databases
• Disconnected data model
• Works with XML

ADO .NET and XML

.NET Framework (Base Class Library)

Common Language Runtime

Operating System
14 Feb 2008 ASP.NET 11
.NET FrameworkP.NET & Windows Forms

• Create application’s front-end – Web-based user


interface, Windows GUI, Web services, …

ASP .NET Windows


Web Forms Web Services
Forms
Mobile Internet Toolkit

ADO .NET and XML

.NET Framework (Base Class Library)

Common Language Runtime

Operating System
14 Feb 2008 ASP.NET 12
.NET Frameworkommon Language Specification

C++Common
C# Language
VB Perl Specification
J# …
ASP .NET Windows
Web Forms Web Services
Forms
Mobile Internet Toolkit

ADO .NET and XML

.NET Framework (Base Class Library)

Common Language Runtime

Operating System
14 Feb 2008 ASP.NET 13
.NET Frameworkisual Studio .NET

C++ C# VB Perl J# …

Common Language Specification

Visual Studio .NET


ASP .NET Windows
Web Forms Web Services
Forms
Mobile Internet Toolkit

ADO .NET and XML

.NET Framework (Base Class Library)

Common Language Runtime

Operating System
14 Feb 2008 ASP.NET 14
.NET Framework Architecture

14 Feb 2008 ASP.NET 15


Common Language Runtime (CLR)

 The core runtime engine in the Microsoft .NET Framework for

executing applications.

 .NET equivalent of the Java Virtual Machine, although JVM

currently supports only the Java language.

 Activates objects, performs security checks on them, lays them

out in memory, executes them, and garbage-collects them.

 Code running in CLR is referred to as “managed code”.

14 Feb 2008 ASP.NET 16


CLR (More…)

 Traditional compilers target a specific processor

 .NET compiler produces binary files containing Common

Intermediate language (CIL), and metadata.

 CLR uses metadata for execution

14 Feb 2008 ASP.NET 17


Jargon Buster

 Managed Code: code that is written to target the

services of the managed runtime execution


environment (like CLR)

 Why managed??? Managed refers to a method of


exchanging information between the program and the

runtime environment

 Then Unmanaged Code???


Code that is directly executed by the Operating
System is known as un-managed code.
14 Feb 2008 ASP.NET 18
Languages Supported by .NET
 Perl  C
 Python  C++
 COBOL  Visual Basic
 Jscript  C#
 Eiffel  SmallTalk
 Java  Oberon
 APL  Scheme
 Haskell  Mercury
 Pascal  Oz
 ML  RPG
 Ada  Objective Caml

14 Feb 2008 ASP.NET 19


Execution of CLR

Code in another
Code in VB.NET Code in C#
.NET Language

Appropriate
VB.NET compiler C# compiler
Compiler

IL(Intermediate
Language) code

CLR just-in-time
execution

Native Code

14 Feb 2008 ASP.NET 20


Intermediate Language (IL)
 .NET languages are not compiled to machine code. They are compiled to an
Intermediate Language (IL).

 CLR accepts the IL code and recompiles it to machine code. The recompilation is
just-in-time (JIT) meaning it is done as soon as a function or subroutine is called.

 The JIT code stays in memory for subsequent calls. In cases where there is not
enough memory it is discarded thus making JIT process interpretive.

14 Feb 2008 ASP.NET 21


JIT Compilation

 Dynamically compiles IL code to managed native code that is optimized

for execution on a target Operating System

 For optimization reasons, JIT compilation occurs only the first time a

method is invoked.

 The compiled native code lies in memory until process shuts down and

garbage-collection takes place.

14 Feb 2008 ASP.NET 22


.NET Framework Architecture

14 Feb 2008 ASP.NET 23


What CLR gives to your Applications

 CLR makes your applications:

• Platform Independent

• Hardware Independent

• Language Independent

14 Feb 2008 ASP.NET 24


The .NET Framework and Visual Studio .NET

Visual Basic® C++ C# JScript® …

Common Language Specification

Visual Studio .NET


ASP.NET: Web Services Windows
and Web Forms Forms

ADO.NET: Data and XML

Base Class Library

Common Language Runtime


14 Feb 2008 ASP.NET 25
ASP.NET

Visual Basic® C++ C# JScript® …

Common Language Specification

Visual Studio.NET
ASP.NET: Web Services Windows
and Web Forms Forms

ADO.NET: Data and XML

Base Class Library

Common Language Runtime


14 Feb 2008 ASP.NET 26
10 Reasons You Love ASP.NET!

1. It’s really, really fast!

2. Deploy and upgrade running apps with XCOPY

3. Great tools support

4. Automatically detects and recovers from errors

5. Web farm scalable session state

6. Built-in output caching

7. Supports wide range of mobile devices

8. Uses compiled languages

9. Makes building web services easy

10. Much simpler page development model


14 Feb 2008 ASP.NET 27
ASP.NET (Contd…)

 The next technology for providing dynamic and interactive web


pages.
 Takes ASP a step further to simplify the development process
of web pages and enhance scalability of web apps.
 Event-based Web Forms, replacing ASP pages, with server
controls. (like VB)
 Clean separation between application logic (server-side code)
and presentation layer – no more spaghetti code!
 Enhanced session-state management
 Application logic can be written in any .NET language
 Application server-side code is compiled for better performance

14 Feb 2008 ASP.NET 28


ASP.NET
Architecture (Page Request)

ASPX

.ASPX
.ASPX

14 Feb 2008 ASP.NET 29


ASP.NET
Architecture (First Time)

Compiled
Compiled .ASPX
.ASPX

14 Feb 2008 ASP.NET 30


ASP.NET
Architecture (Compiled Only Once)

Compiled
Compiled .ASPX
.ASPX

14 Feb 2008 ASP.NET 31


ASP.NET
Architecture (Any Modifications)

Compiled
Compiled .ASPX
.ASPX

14 Feb 2008 ASP.NET 32


ASP.NET Execution Model

Source Visual Basic C# C++


code
Unmanaged
Compiler Compiler Compiler
Component

Managed Assembly Assembly Assembly


code IL Code IL Code IL Code

Common Language Runtime

JIT Compiler

Native Code

Operating System Services


14 Feb 2008 ASP.NET 33
ASP.NET Features

 ASPX, ASP – side by side

 Simplified programming model

 Simplified deployment

 Better performance

 Caching

 Security

 Powerful controls

14 Feb 2008 ASP.NET 34


ASP.NET Features

 Simplified browser support

 Simplified form validation

 Code behind pages

 More powerful data access

 Web services

 Better session management

14 Feb 2008 ASP.NET 35


ASP.NET Features

 XCOPY Deployment.

 Simplified configuration deployment.

 Custom server controls.

 Code Behind Logic.

 Event Delegation Model.

14 Feb 2008 ASP.NET 36


Summary

 Got an Idea what is .NET?

 Why .NET is getting so popular ?

 What is ASP.NET?

 How it works ?

 Hope you started loving .NET !!!☺

14 Feb 2008 ASP.NET 37


14 Feb 2008 ASP.NET 38