Upload
amelina-ahmeti
View
204
Download
0
Embed Size (px)
Citation preview
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
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
Objectives
Introduction to ASP.Net
Basic Advantages
Some Examples
ASP.Net Presentation3
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
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
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
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
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
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
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
.Net - Framework
ASP.Net Presentation11
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
Preserving Data Across Pages
Session InProc StateServer SqlServer
Cookies
Query String
Cookie Independent (Visual Studio 2010)
ASP.Net Presentation13
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
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 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>
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
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
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
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
References www.w3schools.com www.codeproject.com msdn.microsoft.com CiL – Center for Innovative Learning Technologies, RWTH Aachen
University
21 ASP.Net Presentation