Asp dot net long
-
Upload
amelina-ahmeti -
Category
Technology
-
view
3.315 -
download
3
Transcript of Asp dot net long
![Page 1: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/1.jpg)
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 long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/2.jpg)
Commonly used objects The brain:
Client
Server
File and folder
License
Web Technologies2
<html> …</
html>
Can you ask aclever question?
![Page 3: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/3.jpg)
Overview The need for ASP.Net Introduction to ASP.Net .Net Framework .aspx and Code Behind files Page Life Cycle Controls State Management Configuration Files Some Examples ASP.Net v/s PHP
Web Technologies3
![Page 4: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/4.jpg)
Objectives
Introduction to ASP.Net
Basic Advantages
Some Examples
Web Technologies4
![Page 5: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/5.jpg)
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.
1 Introduction5
![Page 6: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/6.jpg)
WHY NOT CONTINUE WITH ASP???
Web Technologies6
![Page 7: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/7.jpg)
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()”
1 Introduction7
![Page 8: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/8.jpg)
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
1 Introduction8
![Page 9: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/9.jpg)
THE RESPONSE – ASP.NET
Web Technologies9
![Page 10: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/10.jpg)
ASP.Net – Issues to Address
Make sure ASP runs fine Since ASP was widely used
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
1 Introduction10
![Page 11: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/11.jpg)
ASP.Net – Advantages
Separation of Code from HTML Completely separate Presentation from Business Logic
Examples
1 Introduction11
![Page 12: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/12.jpg)
Simple Page with a GridView
Web Technologies12
![Page 13: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/13.jpg)
Markup
Web Technologies13
![Page 14: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/14.jpg)
Code Behind File
Web Technologies14
![Page 15: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/15.jpg)
WHAT’S NEW THEN???
Web Technologies15
![Page 16: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/16.jpg)
Simple Page with a GridView 2
Web Technologies16
![Page 17: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/17.jpg)
Markup
Web Technologies17
![Page 18: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/18.jpg)
Code Behind
Web Technologies18
![Page 19: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/19.jpg)
ASP.Net - Advantages Support for compiled languages
Strong typing OOP Pre-compilation to Byte Code and JIT compilation Subsequent requests directed to cached copy until source changes Mostly used languages are
VB.Net C#
Use services provided by the .NET Framework Class libraries provided for different tasks
Data Access Access to Operating system Input / Output
Debugging made a lot easier
1 Introduction19
![Page 20: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/20.jpg)
ASP.Net - Advantages
Graphical Development Environment Drag and Drop Controls
Set the properties graphically IntelliSense Support
Code (VB.Net/C#) HTML XML
State Management Problems with ASP state management addressed Can be recovered even if connection is lost Discussed in detail later
1 Introduction20
![Page 21: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/21.jpg)
ASP.Net - Advantages
Update files while the server is running! Components could be updated while Application is running Server automatically starts using new version Old version kept in memory until the clients have finished
XML-Based Configuration Files Easy to read and modify Ease in application portability
1 Introduction21
![Page 22: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/22.jpg)
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
1 Introduction22
![Page 23: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/23.jpg)
.Net - Framework
1 Introduction23
![Page 24: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/24.jpg)
Short Description of Framework
1 Introduction24
![Page 25: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/25.jpg)
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
Web.config Application Configuration file Allows defining Name, Value pairs that could be accessed by application
1 Introduction25
![Page 26: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/26.jpg)
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 HTML generation by painting of controls
Send the HTML to client browser
1 Introduction26
![Page 27: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/27.jpg)
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
1 Introduction27
![Page 28: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/28.jpg)
PAGE LIFE CYCLE
1 Introduction28
![Page 29: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/29.jpg)
Page Request
IIS determines what type of request it is. ASP.Net requests are forwarded to ISAPI
Decision is made to either parse or compile the page
Or we could just render an existing copy in the Cache.
![Page 30: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/30.jpg)
Start
ASP.Net Environment is created If the Application has been called first time then the
Application Domain is created Page Objects are created
Request Response Context
Set the IsPostBack property
![Page 31: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/31.jpg)
Initialization
Server Controls on the page are initialized
UniqueID of each control is set Skins are applied to controls
Master Page and themes are applied
![Page 32: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/32.jpg)
Load
ViewState is re-constituted
Controls are loaded with data from ViewState and Control State if this is a PostBack request
![Page 33: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/33.jpg)
PostBack Event Handling
Event handlers for server controls are called.
Validation controls perform their validation on the data in the controls and set IsValid property of each Validation Control and the Page.
![Page 34: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/34.jpg)
Rendering
ViewState is saved for the page and controls.
Page calls the Render method of all the server controls, and they all render themselves on the page.
This rendering is done in the OutputStream object of page’s Response Property, and the HTML output is generated.
![Page 35: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/35.jpg)
Unload
Page specific properties are unloaded Request Response
Clean up is performed.
![Page 36: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/36.jpg)
CONTROLS
![Page 37: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/37.jpg)
ASP.Net Controls
HTML server controls
Web server controls
Validation controls
User controls
![Page 38: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/38.jpg)
HTML Server Controls
HTML elements on an ASP.NET Web page are not available to the server.
treated as opaque text and passed through to the browser.
HTML elements containing attributes that make them programmable in server code.
![Page 39: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/39.jpg)
Web Server Controls
A second set of controls designed for a different emphasis Do not necessarily map one-to-one to HTML server controls
Defined as Abstract controls
Have more built-in features than HTML controls e.g. Calendar, Menus etc.
![Page 40: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/40.jpg)
Validation Controls
Do client side validation like Input required for a text box Test against a specific value Test a specific pattern for input Whether a value lies within some range Etc.
![Page 41: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/41.jpg)
User Controls
Controls created by the User as ASP.Net webpages
Can be embedded in other pages
Re-usability and Power to User.
![Page 42: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/42.jpg)
POST BACK, VIEW STATE AND SESSION CONTROL
![Page 43: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/43.jpg)
Post Back
Server controls
Post Back to the same page
Server control initiated request
![Page 44: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/44.jpg)
View State
Persist state across PostBacks (Same Page)
Programmatic changes to the page's state
No free lunches Cost of ViewState
Extra time in rendering
![Page 45: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/45.jpg)
Preserving Data Across Pages
Session InProc StateServer SqlServer
Cookies QueryString Cookie Independant
![Page 46: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/46.jpg)
CONFIGURATION FILES
Web Technologies46
![Page 47: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/47.jpg)
Global.asax
Declare application level Events and Objects Code for events like
Application Start Application End
Since this code cannot be places in application itself Also used for Application and Session State Management Compiled just like any other ASP.Net page
Subsequent compiles made on changes
Web Technologies47
![Page 48: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/48.jpg)
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
Web Technologies48
![Page 49: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/49.jpg)
COMPARISON WITH PHP
Web Technologies49
![Page 50: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/50.jpg)
Believed that PHP is faster No proof available
ASP.Net is a platform C#/VB.Net used for server operation ASP.Net provides controls and designing tools PHP contains scripting tags, and no controls
Cost Microsoft Platform
Platform Compatibility CLR but not IIS
Web Technologies50
![Page 51: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/51.jpg)
Database connectivity PHP used for DB connectivity ASP.Net uses Framework to access DB
Object Oriented Design ASP.Net is built on OOP paradigm PHP supports minimal level OOP
Compilation PHP
HTML and PHP to Zend Opcodes Zend Engine generates HTML
ASP.Net MSIL Page Rendering
Web Technologies51
![Page 52: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/52.jpg)
Web Server PHP
Runs on both IIS and Apache, hence platform independent ASP.Net
Runs only on IIS Data Security
ASP.Net has enhanced and enriched features PHP lesser features
Propriety PHP is open source ASP.Net is Microsoft Product
Some new tools like in AJAX are open source
Web Technologies52
![Page 53: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/53.jpg)
Summary
Web Technologies53
![Page 54: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/54.jpg)
Outlook
Web Technologies54
![Page 55: Asp dot net long](https://reader035.fdocuments.us/reader035/viewer/2022062319/55498170b4c905b96a8b4848/html5/thumbnails/55.jpg)
References www.w3schools.com www.codeproject.com msdn.microsoft.com
1 Introduction55