Advance Programming Languages
Introduction to ASP. Net
by Dr Hafiz Farooq Ahmad
CCSIT, KFU
INTRODUCTION TO ASP.NET
ASP.NET is part of the Microsoft .NET framework
ASP.NET is an effective and flexible technology for creating interactive and
dynamic web pages.
It is a convergence of two major Microsoft technologies:
Active Server Pages (ASP)
ASP is Microsoft’s server side scripting technology for building dynamic web pages.
.NET Framework
The .NET Framework is a suite of technologies designed by Microsoft where program development takes place.
It is built on .NET Common Language Runtime
INTRODUCTION TO ASP.NET
ASP.NET Features:
Provides better user authentication
Has better language support.
Has a large set of new controls (web controls)
Uses compiled code, which increases the performance of the applications
It is programmable using any of the .NET languages (VB.NET, C#, VJ# etc).
The ASP.NET pages are saved with the .aspx extension.
CODE BEHIND PAGES
Binds HTML page to a code file written in a .NET language
HTML page is encapsulated in a System.Web.UI.Page class
All ASP.NET controls can be used as regular .NET objects
Everything will eventually end up as HTML
SEPARATION OF CODE FROM CONTENT
With code behind Pages developers and designers can work independently
Single Separate files
file
<Tags> code <Tags>
code
WebForm1.aspx.cs WebForm1.aspx
form1.asp
PAGE DEVELOPMENT
Page is loaded, control hierarchy initialized
Page_Load Page is loaded
Control events
List1_SelectedIndexChanged
1. Change Events
2. Action Events Button1_Click
Page_Unload
Page is disposed
SESSION AND APPLICATION
VARIABLES
Session variables
Remembered until the client closes the browser (or the session timeout expires – default 20
minutes)
Only for one client
Session[“ValidUser”] = true
Application variables
Always remembered
For all clients
Application[“NumClients”] = NumClients + 1
WORKING OF AN ASP.NET APPLICATION
To execute an ASP.NET file, the following steps
are followed:
ASP.NET
Script
Engine
1. A web browser sends a request for an ASP.NET
file to the web server by using a URL.
2. The web server receives the request and retrieves
the appropriate ASP.NET file from the disk or
memory.
3. The web server forwards the file to the ASP.NET WEB
script engine for processing. SERVER
CLIENT
WORKING OF AN ASP.NET APPLICATION
4. The ASP.NET script engine reads
the file from top to bottom and
executes it. ASP.NET
Script
5. The processed ASP.NET file is Engine
generated as an HTML document and
the ASP.NET script engine sends the
HTML page to the Web server.
6. The Web server then sends the
HTML code to the client which
interprets the output and displays it.
WEB
SERVER
CLIENT
ADVANTAGES OF ASP.NET
Easy Programming Model
Flexible Language Options
Compiled Execution
Rich Class Framework
Web-Farm Session State
Enhanced Reliability
Master Pages , Themes
Improved Security
Improved Performance and Scalability
ANY QUESTION