0% found this document useful (0 votes)
122 views46 pages

Chapter 5 - Introduction To

The document provides an introduction to ASP.NET, explaining what it is, how it works, and its advantages over ASP. It discusses the introduction to ASP and ASP.NET, how each works, objects in ASP, prerequisites for ASP.NET, language support, and what HTTP is.

Uploaded by

phannarith
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
122 views46 pages

Chapter 5 - Introduction To

The document provides an introduction to ASP.NET, explaining what it is, how it works, and its advantages over ASP. It discusses the introduction to ASP and ASP.NET, how each works, objects in ASP, prerequisites for ASP.NET, language support, and what HTTP is.

Uploaded by

phannarith
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 46

ASP.

NET Introduction

ASP.NET Introduction

Main Menu 1 of 46
ASP.NET Introduction

Objective
 At the end of this chapter, you will be able to
understand what ASP.NET is and how the ASP &
ASP.NET pages work.
 Besides, you’ll be able to understand the advantages
ASP.NET provides over ASP.

Main Menu 2 of 46
ASP.NET Introduction

Scope
 Introduction to ASP
 Introduction to ASP.NET
 How ASP.NET works
 Advantage of ASP.NET over ASP
 Pre requisite for learning ASP.NET
 Language support
 What is HTTP
 Writing first ASP.NET Page

Main Menu 3 of 46
ASP.NET Introduction

Introduction to ASP
 Microsoft introduced Active Server Pages in
December 1996. Microsoft made it available for its
Internet Information Server (IIS).
 ASP Page is saved with an extension of .asp e.g.
“test.asp”, which is interpreted at the server end.
 ASP code can be written in VBScript or Jscript or
Perl or any other scripting language provided the
server has a scripting engine available for script.

Main Menu 4 of 46
ASP.NET Introduction

How ASP work


The working of an ASP page can be well understood
with following 8 steps.
 A user enters the web site name in the URL using

his browser.
• Internet then connects to the specified server where the
Web page resides.
• The requested server is a Windows NT server running the
IIS.

Main Menu 5 of 46
ASP.NET Introduction

How ASP work


 The Web server receives the request, and searches
for the specified file, which may be an ASP file or a
HTML file, which contains a HTML form.
 The server then sends this file to the browser, or to
the client, where the user is supposed to fill in the
form and submit it to the server.

Main Menu 6 of 46
ASP.NET Introduction

How ASP work


 User then fills up the form and clicks the SUBMIT
button on the form, the information in the form is
sent to the server along with the name of an ASP
program whose name was embedded into this
HTML file.
 The server gets the requested ASP file along with
the information in the form and interprets it using
the ASP.dll

Main Menu 7 of 46
ASP.NET Introduction

How ASP work


 If during the processing of ASP it needs some
information from a database, it connects to the
database and retrieves the required information from
it using some COM components like the ActiveX
data objects (ADO)
 The ASP file is processed and the results are
generated in standard HTML
 This file containing the standard HTML is sent back
to user where the browser displays the result.

Main Menu 8 of 46
ASP.NET Introduction

ASP Objects
 An Object can be defined as something that has
methods, properties, and collections.
 ASP has the following built-in objects :
 The ScriptingContext Object: It is available
to the scripting host along with the scripting objects.
• The Request Object
• The Response Object
• The Application Object
• The Session Object
• The Server Object

Main Menu 9 of 46
ASP.NET Introduction

Introduction to ASP.NET
 ASP.NET has been built on common language
runtime that can be used on a server to build
powerful web Applications.
 It is a part of emerging Microsoft .NET platform and
provides innovative ways to build and deploy the
next generation of ASP for use in high performance
web solutions.
 ASP.NET is largely syntax compatible with ASP.

Main Menu 10 of 46
ASP.NET Introduction

How ASP.NET Works


The working of an ASP page can be well understood
with following steps. Whole process can be divided
into 8 steps, which are as follows.
 A user requests for an ASP.NET page in his
browser.
 An HTTP request is sent to IIS.
 The xspisapi.dll filters the request and passes the
request to XSP worker process (XSPWP.EXE).

Main Menu 11 of 46
ASP.NET Introduction

How ASP.NET Works


 The requested .aspx page (ASP.NET page is saved
with an extension of .aspx) is read from hard disk or
cache memory and a new class is generated which
contains the programming logic of the aspx page.
This class is loaded in the memory and executed.
 The server side code generates normal HTML page,
which is sent back to IIS following the same route.
IIS sends the page to browser.

Main Menu 12 of 46
ASP.NET Introduction

How ASP.NET Works


 Now if the user clicks in the page or after filling
some information again sends the page back to the
server.
 The new class handles all the queries sent by the
user. Requests are processed by this class and
response is prepared.
 Another HTML page is generated after processing
the information sent by the user. This HTML page is
sent to the user.

Main Menu 13 of 46
ASP.NET Introduction

ASP.NET over ASP


 Better Performance
• The ASP.NET page is not read like a new page every
time.
• An ASP.NET file is compiled only the first time it is
accessed.
• If the page has been sent back then, only modified area is
read at server. Next request for the same page will use the
compiled type instance.

Main Menu 14 of 46
ASP.NET Introduction

ASP.NET over ASP


 Simplicity
• ASP.NET framework allows you to create a web
application that cleanly separates application logic from
presentation code.
• Also common language runtime simplifies development
with managed code services like garbage collection,
debugging facility and automatic reference counting.

Main Menu 15 of 46
ASP.NET Introduction

ASP.NET over ASP


 Better tool support
• At the core of ASP.NET is its HTTP runtime (different
from common language runtime), a high performance
execution engine for processing HTTP commands.
• The HTTP runtime is responsible for processing all the
incoming HTTP requests.
• ASP.NET is support for live updating of applications.

Main Menu 16 of 46
ASP.NET Introduction

ASP.NET over ASP


 Language support
• ASP.NET supports all the languages supported by the
.NET Framework.
• ASP.NET currently offers support for three languages:
C#, VB.NET and Jscript.NET.

Main Menu 17 of 46
ASP.NET Introduction

ASP.NET over ASP


 Security
• ASP.NET supports HTML forms based authentication.
• ASP.NET works in conjunction with IIS to provide
authentication and authorization services to applications.
• As soon as the authentication is done process of
authorization may start.

Main Menu 18 of 46
ASP.NET Introduction

ASP.NET over ASP


 Separation of code from html code
• You can separate your programming code from normal
HTML part.
• This makes easier to create, maintain and modify any
ASP.NET page.

Main Menu 19 of 46
ASP.NET Introduction

ASP.NET over ASP


 Less code
• ASP.NET has been enriched with server controls.
• This reduces amount of coding that you need to write.
• All you have to do is to use below mentioned directive: -
<runat = server>

Main Menu 20 of 46
ASP.NET Introduction

ASP.NET over ASP


 Caching
• Caching is a technique that is used widely to increase the
performance by keeping frequently accessed or expensive
data in memory.
• ASP.NET offers three types of caching
• Output caching
• Data caching
• Fragment caching

Main Menu 21 of 46
ASP.NET Introduction

Pre-Requisite for ASP.NET


 ASP.NET has been simplified a lot which makes it
very easy to learn.
 All you need is knowledge of HTML, internet and a
language supported in .NET framework.
 You have the option to choose any of three
languages, presently supported in ASP.NET.
• VB.NET
• C#
• Jscript

Main Menu 22 of 46
ASP.NET Introduction

Language Support
 Now let us see how ASP.NET supports these three
languages.
 All you have to do is declare which language you
will be using in your ASP.NET page, in the
following syntax at the start of your page.
<%@ Page Language = “VB” %>
<%@ Page Language = “C#” %>
<%@ Page Language = “JScript” %>
 VB is the default language for ASP.NET
Main Menu 23 of 46
ASP.NET Introduction

What is HTTP?
 HTTP (Hyper Text Transfer Protocol) is used for
transferring the messages between web server and
web browser.
 HTTP protocol specifies how messages can be
transported over the TCP/IP network between web
server and web browser.
 It specifies the ways in which a browser and Web
server can interact.

Main Menu 24 of 46
ASP.NET Introduction

What is HTTP?
 Whenever you retrieve a page from a web site, your
browser opens a connection to a web server for that
site and sends a request.
 The web server receives the request and issues a
response.
 All communication between a browser and a web
server takes place with the help of request and
response pair.
 HTTP protocol is also known as request and
response protocol.

Main Menu 25 of 46
ASP.NET Introduction

What is HTTP?
 A browser request has a certain standard structure.
 A request might also contain a message body or
entity body.
 Every response begins with the status line, contains
several headers, and may contain a message body.
 A status line indicates the protocol being used, a
status code, and a text message.

Main Menu 26 of 46
ASP.NET Introduction

Writing First ASP.NET Page


 Configuring IIS 5.0
• To write your first ASP.NET page, first of all create a
directory.
• Now click on Start – Programs – Administrative Tools –
Internet Services Manager
• Now right click on Default Web Site on the left window
and select New and Virtual Directory

Main Menu 27 of 46
ASP.NET Introduction

Configuring IIS 5.0


 Once you click on the Virtual Directory you will
view the following screen :

Main Menu 28 of 46
ASP.NET Introduction

Configuring IIS 5.0


 Click on next and type the Alias name i.e. this is the
name of your default directory.
 Next screen will ask for the existing directory, which
will contain all the real examples.
 Here you will be giving the name of the directory,
which was created initially.
 Again click on next and the next screen will tell you
that you have successfully completed the virtual
directory creation wizard. Click on finish.

Main Menu 29 of 46
ASP.NET Introduction

Creating ASP.NET Application


 Open Microsoft Visual Studio .NET.
 In the start page click on New Project button.
 Click on ASP.NET Web Application
 Give a name say “Ch1” and specify the location of
the virtual directory that you created using IIS.
 In the Toolbox, under the Web Forms tab, drag a
button and drop it on the form.

Main Menu 30 of 46
ASP.NET Introduction

Creating ASP.NET Application


 Set the ID property of the button to “clickBtn”
 Set the Text property of the button to “Click Me”.
 Now double click on the button to open the code
window which shows the click event of the button.
 Write the following code in it :
clickBtn.Text= “Hello ASP.NET”

Main Menu 31 of 46
ASP.NET Introduction

Creating ASP.NET Application


 Click on the Start button and your application runs
in the browser and on click of the button, you can
see the text on the button changing.
Or
 View the output of your aspx page by opening
internet explorer and type in the URL
http://localhost/WebForms/Ch1/WebForm1.asp

Main Menu 32 of 46
ASP.NET Introduction

Creating ASP.NET Application

 You will see the


following
output.

Main Menu 33 of 46
ASP.NET Introduction

Configuring Front Page 2002


 The following steps need to be performed in Front
Page to create a new web site.
• Open Front Page 2002 and click on Menu item File
New  Page or Web.
 Select the option empty web from the right window.

Main Menu 34 of 46
ASP.NET Introduction

Configuring Front Page 2002


 A dialog box is displayed, select one page web from
it and in the location textbox specify a folder in C
drive say, FrontPageWeb.

Main Menu 35 of 46
ASP.NET Introduction

Configuring Front Page 2002


 Your web is now created using Front Page.
 Double click on the index page (this is the home
page of your web site).
 Click on new page button on the toolbar to add a
new page.
 Save this page with an .aspx extension say,
“one.aspx”.

Main Menu 36 of 46
ASP.NET Introduction

Configuring Front Page 2002


 Go to HTML tab and write the following code
<%Response.Write (“Hello ASP.NET”) %>

Main Menu 37 of 46
ASP.NET Introduction

Configuring Front Page 2002


 Add a hyperlink in home page which points to the
new .aspx page by clicking on Menu Item Insert 
Hyperlink.

Main Menu 38 of 46
ASP.NET Introduction

Configuring Front Page 2002


 Now Click on the publish button in the toolbar or go
to Menu item FilePublish Web.
 Specify the URL of your web site say
http://localhost/aa and click on PUBLISH Button.

Main Menu 39 of 46
ASP.NET Introduction

Configuring Front Page 2002


 Click on the first hyperlink i.e. “Click here to view
your published site” to display your web site on the
Web Browser.

Main Menu 40 of 46
ASP.NET Introduction

Configuring Front Page 2002


 Click on the hyperlink on the web page to display
your .aspx page on the web browser.

Main Menu 41 of 46
ASP.NET Introduction

Configuring Front Page 2002


 The Output would be as follows :

Main Menu 42 of 46
ASP.NET Introduction

Summary
 Key points covered in this chapter are:
• ASP lacks in performance as it supports scripting languages
only. ASP.NET has been introduced by Microsoft under
.NET framework, to overcome the drawbacks of ASP
• To understand ASP.NET, you should have knowledge of
any language supported in .NET Framework and familiarity
with the environment of Visual Studio.NET.
• ASP.NET provides lots of advantages over ASP e.g.
performance, tool support, rich hierarchy, separation of
code from HTML code, less code, caching etc.

Main Menu 43 of 46
ASP.NET Introduction

Summary
• ASP.NET supports three languages at present i.e. VB, C#,
Jscript.
• HTTP is a protocol, which defines rules to be followed by
the web browser and server.
• ASP.NET page or the Web Forms can be created from a
simple notepad or the Visual Studio.NET IDE and even
from Front Page 2002.
• Configuration of IIS 5.0 Server
• Configuration of Front Page Server extensions.

Main Menu 44 of 46
ASP.NET Introduction

Self Assessment
 State True or False
• ASP understands only compile type languages.
• ASP.NET has replaced ASP completely.
• ASP.NET is interpreted at the server.
• ASP supports only 3 objects.
• ASP.NET supports C# and VB.
• ASP.NET supports JavaScript.
• ASP.NET supports caching.
• ASP.NET requires heavy coding from the developer for
any task.

Main Menu 45 of 46
ASP.NET Introduction

Self Assessment
 Fill in the blanks
• Caching is used to save ______________ accessed data at
the server end. (Frequently / rarely).

Main Menu 46 of 46

You might also like