Concepts of Asp.Net

29
The Global Open University Nagaland ASP.NET Special Tips & Tricks

description

 

Transcript of Concepts of Asp.Net

Page 1: Concepts of Asp.Net

The Global Open University

Nagaland

ASP.NET

Special Tips & Tricks

Page 2: Concepts of Asp.Net

Agenda

Part I - FundamentalsProgramming ModelsDesign Goals and ArchitectureCLR Services– Visual Studio 2005

Page 3: Concepts of Asp.Net

Unify Programming Models

Windows APIWindows API

.NET Framework.NET Framework

Consistent API availability regardless ofConsistent API availability regardless oflanguage and programming modellanguage and programming model

ASPASP

Stateless,Stateless,Code embeddedCode embeddedin HTML pagesin HTML pages

MFC/ATLMFC/ATL

Subclassing,Subclassing,Power,Power,

ExpressivenessExpressiveness

VB FormsVB Forms

RAD,RAD,Composition,Composition,

DelegationDelegation

Page 4: Concepts of Asp.Net

Make It Simple To Use

OrganizationCode organized in hierarchical namespaces and

classes

Unified type systemEverything is an object, no variants, one string type,

all character data is Unicode

Component OrientedProperties, methods, events, and attributes are first

class constructsDesign-time functionality

Page 5: Concepts of Asp.Net

How Much Simpler?

HWND hwndMain = CreateWindowEx(HWND hwndMain = CreateWindowEx( 0, "MainWClass", "Main Window",0, "MainWClass", "Main Window", WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL,WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, CW_USEDEFAULT, CW_USEDEFAULT,CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,CW_USEDEFAULT, CW_USEDEFAULT, (HWND)NULL, (HMENU)NULL, hInstance, NULL); (HWND)NULL, (HMENU)NULL, hInstance, NULL); ShowWindow(hwndMain, SW_SHOWDEFAULT); ShowWindow(hwndMain, SW_SHOWDEFAULT); UpdateWindow(hwndMain);UpdateWindow(hwndMain);

Form form = new Form();Form form = new Form();form.Text = "Main Window";form.Text = "Main Window";form.Show();form.Show();

Windows APIWindows API

.NET Framework.NET Framework

Page 6: Concepts of Asp.Net

Hello World Demo What you need

Page 7: Concepts of Asp.Net

Agenda Part I - Fundamentals

Programming ModelsProgramming ModelsDesign Goals and ArchitectureCLR ServicesCLR Services

Page 8: Concepts of Asp.Net

Common Language RuntimeDesign Goals

Dramatically simplifies development and deployment

Unifies programming models Provides robust and secure execution

environment Supports multiple programming languages

Page 9: Concepts of Asp.Net

Architectural Overview

Co

mm

on

Lan

gu

age

Ru

nti

me

Co

mm

on

Lan

gu

age

Ru

nti

me

FrameworkFramework

Class loader and layoutClass loader and layout

GC, stack walk, code managerGC, stack walk, code manager

IL t

o

IL t

o

nat

ive

cod

e n

ativ

e co

de

com

pile

rsco

mp

ilers

Sec

uri

tyS

ecu

rity

Exe

cuti

on

Exe

cuti

on

Su

pp

ort

Su

pp

ort

Base ClassesBase Classes

Page 10: Concepts of Asp.Net

AssemblyAssembly

Compilation And Execution

Source Source CodeCode

Language Language CompilerCompiler

CompilationCompilation

At installation or the At installation or the first time each first time each

method is calledmethod is calledExecutionExecution

JIT JIT CompilerCompiler

NativeNative

CodeCode

Code (IL)Code (IL)

MetadataMetadata

Page 11: Concepts of Asp.Net

Languages

The CLR is Language Neutral All languages are first class players You can leverage your existing skills

Common Language Specification Set of features guaranteed to be in all languages

We are providing VB, C++, C#, J#, JScript

Third-parties are building APL, COBOL, Pascal, Eiffel, Haskell, ML, Oberon,

Perl, Python, Scheme, Smalltalk…

Page 12: Concepts of Asp.Net

Hello World Demo What you needWhat you need MSIL

Page 13: Concepts of Asp.Net

Agenda Part I - Fundamentals

Programming ModelsProgramming ModelsDesign Goals and ArchitectureDesign Goals and ArchitectureCLR Services

Page 14: Concepts of Asp.Net

Component-Based Programming 3 core technologies make building and

using components easyType safetyAutomatic memory managementMetadata

This greatly simplifies application development

Page 15: Concepts of Asp.Net

Type Safety Type safety ensures that objects are used the

way they were intended to be usedPrevents an object’s state from being corrupted

The CLR enforces type safetyAttempting to coerce an object to an incompatible type

causes the CLR to throw an exception

Type safety means code confidenceCommon programmer errors will be found immediately

Rectangle(hwnd, 0, 0, 10, 10);

//hwnd should be an hdc

MessageBox(hwnd, “”, “”, IDOK);

//IDOK should be MB_OK

Page 16: Concepts of Asp.Net

Automatic Memory Management

The CLR tracks the code’s use of objects and ensures Objects are not freed while still in use (no memory corruption) Objects are freed when no longer in use (no memory leaks)

Code is easier to write because there is no question as to which component is responsible to free an object When passed a buffer, who frees it: caller or callee?

Each process has 1 heap used by all components Objects can’t be allocated from different heaps You don’t have to know which heap memory was allocated in or

which API to call to free the memory○ In fact, there is no API to free memory, the GC does it

Page 17: Concepts of Asp.Net

Metadata Set of data tables embedded in an EXE/DLL

The tables describe what is defined in the file (Type, fields, methods, etc.) Every component’s interface is described by metadata tables

A component’s implementation is described by Intermediate Language The existence of metadata tables enables many features

No header files Visual Studio’s IntelliSense Components don’t have to be registered in the registry Components don’t need separate IDL or TLB files The GC knows when an object’s fields refer to other objects An object’s fields can be automatically serialized/deserialized At runtime, an application can determine what types are in a file and what

members the type defines (also known as late binding) Components can be written/used by different languages

Page 18: Concepts of Asp.Net

Metadata: Creation And Use

MetadataMetadata(and code)(and code)

DebuggerDebugger

Schema Schema GeneratorGenerator

ProfilerProfiler

CompilersCompilers

Proxy GeneratorProxy Generator

Type BrowserType Browser

CompilerCompiler

SourceSourceCodeCode

XML encodingXML encoding(SDL or SUDS)(SDL or SUDS)

SerializationSerialization

DesignersDesigners

ReflectionReflection

TLB ExporterTLB Exporter

Page 19: Concepts of Asp.Net

Runtime Execution Model

ClassClassLoaderLoader

CPUCPU

ManagedManagedNative CodeNative Code

AssemblyAssembly

First callFirst callto methodto method

First reference First reference to to typetype

AssemblyAssemblyResolverResolver

First reference First reference to Assemblyto Assembly

IL to nativeIL to nativeconversionconversion

Page 20: Concepts of Asp.Net

JIT Compiler - Inline

Page 21: Concepts of Asp.Net

Standardization A subset of the .NET Framework and C#

submitted to ECMAECMA and ISO International StandardsCo-sponsored with Intel, Hewlett-Packard

Common Language InfrastructureBased on Common Language Runtime and Base

FrameworkLayered into increasing levels of functionality

Page 22: Concepts of Asp.Net

Rotor (SSCLI)

Shared-Source version of the CLR+BCL+C# compiler

Ports available: Windows, FreeBSD, OSX, etc

Real product code offers real world learning

http://sscli.org

Page 23: Concepts of Asp.Net

Developer Roadmap

• “ “Orcas” releaseOrcas” release

• Windows “Longhorn” Windows “Longhorn” integrationintegration

• New UI tools and New UI tools and designers designers

• Extensive managed Extensive managed interfacesinterfaces

Visual Studio Visual Studio Orcas Orcas

“Longhorn”“Longhorn”

Visual StudioVisual Studio.NET 2003.NET 2003

• “ “Everett Release”Everett Release”

• Windows Server 2003 Windows Server 2003 integrationintegration

• Support for .NET Support for .NET Compact Framework Compact Framework and device and device development development

• Improved performanceImproved performance

Visual Studio 2005 Visual Studio 2005 “Yukon”“Yukon”

• “ “Whidbey” releaseWhidbey” release

• SQL Server SQL Server integrationintegration

• Improved IDE Improved IDE productivity and productivity and community supportcommunity support

• Extended support for Extended support for XML Web servicesXML Web services

• Office Office programmabilityprogrammability

Page 24: Concepts of Asp.Net

Agenda Part I - FundamentalsPart I - Fundamentals

Design Goals Design Goals ArchitectureArchitectureCLR ServicesCLR Services

Page 25: Concepts of Asp.Net

Agenda Part I - FundamentalsPart I - Fundamentals

Design Goals Design Goals ArchitectureArchitectureCLR ServicesCLR Services

Page 26: Concepts of Asp.Net

PerformanceObjectives: make .NET an even greater programming

platform Long-Term: make the performance characteristics of the CLR

similar to native code Reduce marginal cost of additional managed processes Reduce startup time and working set

NGen Compiles IL code to native code, saving results to disk Advantages: no need to recompile IL to native code, and

class layout already set so better startup time Whidbey: Significant reductions in the amount of private,

non-shareable working set OS: ‘no-Jit’ plan, all managed code will be NGened

Page 27: Concepts of Asp.Net

TryParseTryParse

Page 28: Concepts of Asp.Net

CLR Security New cryptography support

PKI and PKCS7 supportXML encryption supportEnhanced support for X509 certificates

Enhanced Application SecurityPermission Calculator

○ Integration with ClickOnceBetter SecurityExceptionDebug-In-Zone

Managed ACL Support

Page 29: Concepts of Asp.Net

This material has been taken from Online Certificate course on ASP.NET from Global Open University Online certification programme. For complete course material visit: http://tgouwp.eduhttp://tgouwp.edu

About Global Open University :The global open university is now offering certification courses in various fields. Even you can study, give exam from comfort of your home. These are short term and totally online courses. For more details you can visit:

Email id: [email protected]: http://tgouwp.edu

THANKS for being here