21
Server side technologies ASP.Net Amelina Ahmeti, Sultonmamad, Usman Web Technologies – Prof. Dr. Ulrik Schroeder – WS 2010/11 1 The slides are licensed under a Creative Commons Attribution 3.0 License

Asp dot net final (1)

Embed Size (px)

Citation preview

Page 1: Asp dot net   final (1)

Server side technologiesASP.Net

Amelina Ahmeti, Sultonmamad, Usman

Web Technologies – Prof. Dr. Ulrik Schroeder – WS 2010/111The slides are licensed under a

Creative Commons Attribution 3.0 License

Page 2: Asp dot net   final (1)

Overview

ASP.Net v/s PHP The need for ASP.Net Introduction to ASP.Net .Net Framework .aspx and Code Behind files Page Life Cycle Controls State Management Configuration Files

ASP.Net Presentation2

Page 3: Asp dot net   final (1)

Objectives

Introduction to ASP.Net

Basic Advantages

Some Examples

ASP.Net Presentation3

Page 4: Asp dot net   final (1)

Comparison with PHP

Wide belief that PHP is faster ASP.Net is a platform Cost Web Server Propriety JIT (Just In Time) Compilation

Discussed in Detail Later!

4 ASP.Net Presentation

Page 5: Asp dot net   final (1)

ASP – Active Server Pages

Server-side scripts Also client-side scripts Validate user inputs Access database ASP provides solutions for transaction processing and managing

session state. One of the most successful languages for Web development.

ASP.Net Presentation5

Page 6: Asp dot net   final (1)

Problems with ASP

Interpreted and Loosely typed code Late binding of Variables Uses Jscript or VBScript

Mixes layout (HTML) and logic (scripting code) Frequent switches between HTML and ASP code Hard to separate Content and Business Logic

Limited Development and Debugging Tools Visual InterDev, Macromedia helped Debugging done using “Response.Write()”

ASP.Net Presentation6

Page 7: Asp dot net   final (1)

Problems with ASP No real state management

Process Dependent Server Farm Limitations Cookie Dependent

Update files only when server is down To update components based site you have to stop the server If not Application fails

Obscure Configuration Settings Configurations stored in IIS Metabase Difficult to port application

ASP.Net Presentation7

Page 8: Asp dot net   final (1)

ASP.Net – Issues to Address

Make sure ASP runs fine Since ASP was widely used Had a very large programmer base

Introduction of .Net Framework ASP.DLL not modified while installing framework IIS could run ASP and ASP.Net simultaneously

Overcome the short comings in ASP

ASP.Net Presentation8

Page 9: Asp dot net   final (1)

ASP.Net - Advantages

Support for compiled languages Separation of Code from HTML Use services provided by the .NET Framework Easier Debugging using Visual Studio Graphical Development Environment Session Management Update files while the server is running! XML-Based Configuration Files

ASP.Net Presentation9

Page 10: Asp dot net   final (1)

ASP.Net - Overview

Server side technology Web Forms used to build Web Applications Provides services to create and use Web Services Controls

HTML Controls Web Server Control User Controls

Ease of application development

ASP.Net Presentation10

Page 11: Asp dot net   final (1)

.Net - Framework

ASP.Net Presentation11

Page 12: Asp dot net   final (1)

ASP.Net - Files

A simple ASP.Net file consists of two files Presentation (.aspx) Code Behind (.aspx.cs for C#)

Web Services have the extension .asmx Configuration Files

Global.asax (also has a code behind file) Optional file containing global logic Also has a code behind file

Web.config Application Configuration file Allows defining Name, Value pairs that could be accessed by application

ASP.Net Presentation12

Page 13: Asp dot net   final (1)

Preserving Data Across Pages

Session InProc StateServer SqlServer

Cookies

Query String

Cookie Independent (Visual Studio 2010)

ASP.Net Presentation13

Page 14: Asp dot net   final (1)

Execution Cycle

Request aspx page ASP.Net runtime parses file for code to be compiled Generation of Page class (ASP.Net Page)

Instantiates server controls Populates server controls

Rendering of Controls Send the HTML to client browser

ASP.Net Presentation14

Page 15: Asp dot net   final (1)

Execution Process

Compiling the code First time request Code compiled to MSIL(Microsoft Intermediate Language)

Similar to Assembly Language Used to achieve platform independency

Not the target what Microsoft wants CPU independence Efficient conversion to Native code

CLR(Common Language Runtime) compiles the code A copy of Page is Cached

Used until changes are made to the page, and it needs to be compiled again Updating the page causes a re-build

ASP.Net Presentation15

Page 16: Asp dot net   final (1)

Page Life Cycle

Web Technologies16

ASPX Page RequestedASPX Page Requested

Request Page

StartStart

InitializationInitialization

LoadLoad

Post Back Event HandlingPost Back Event Handling

RenderingRendering

UnloadUnload

<html> …

</html>

Page 17: Asp dot net   final (1)

Web BrowserWeb Browser

15/10/2010 ASP.Net Presentation17

Just-In-Time Compilation

ASPX File

ASPX File

Code BehindCode

Behind

Page Class File

Page Class File

ASPX Engin

e

ASPX Engin

e

Page ClassPage Class

Request #1Request #1

Request #nRequest #n

Courtesy: Patrick

Stalljohann

Courtesy: Patrick

Stalljohann

Page 18: Asp dot net   final (1)

ASP.Net Controls HTML server controls

HTML elements programmable in server code. HTML tags are left as is by compiler

Web server controls Defined as Abstract controls Have more built-in features than HTML controls e.g. Calendar,

Menus etc. Validation controls

Perform client side validation Can be used to build own validators

User controls Controls created by the User as ASP.Net webpages Re-usability and Power to User.

ASP.Net Presentation18

Page 19: Asp dot net   final (1)

Global.asax

Declare application level Events and Objects Code for events like

Application Start Application End Session Start Session End

Since this code cannot be placed in application itself Also used for Application and Session State Management Compiled just like any other ASP.Net page

ASP.Net Presentation19

Page 20: Asp dot net   final (1)

Web.config

Stores configuration information in XML format

Optional

Allows for creating Name, Value pairs that could be accessed by the web application to apply configurations

Portable

ASP.Net Presentation20

Page 21: Asp dot net   final (1)

References www.w3schools.com www.codeproject.com msdn.microsoft.com CiL – Center for Innovative Learning Technologies, RWTH Aachen

University

21 ASP.Net Presentation