2. ASP.NET Overview
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
2
ASP.NET is a Microsoft technology for building web applications
that leverages all the fantastic technologies you can find in .NET
Framework.
ASP.NET is an exciting web programming technology pioneered by
Microsoft that allows developers to create dynamic web pages.
ASP.NET is a robust and mature technology. ASP.NET version 1.0
was released in January 2002 and quickly became the web
programming technology of choice for many. In November 2005,
Microsoft released the much-anticipated version 2.0. Two years
later, in November 2007, Microsoft released ASP.NET version 3.5.
And ASP.NET 4 was unveiled in April 2010.
SQL Server 2008 is a database engine, which is a specialized
application designed to efficiently store and query data. Many
websites interact with databases; any ecommerce website, for
example, displays product information and records purchase orders
in a database.
3. ASP.NET websites and web pages
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
3
ASP.NET web pages are simple text files, meaning that you
can create them using any text editor (such as Microsoft
Notepad), but if you’ve created websites before, you know that
using a tool such as Microsoft Expression
Web or Adobe Dreamweaver makes the development process
much easier than using a generic text editor such as Notepad.
This is the case for ASP.NET, as well.
Before we create our first ASP.NET website, we need to install
the .NET Framework, Visual Web Developer, and SQL Server.
The .NET Framework is a rich platform for creating Windows-
based applications and is the underlying technology used to
create ASP.NET websites.
4. Dynamic Website with ASP.NET
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
4
5. Web Application
6/17/2013SETEC Institute [Web Development with ASP.NET , prepare by ASP.NET Lecturer Team.]
5
A collection of Web Pages, comprising images, video,
and other digital assets providing relevant
information.
A Web Application make use of the Internet to make
itself accessible to users from all over the world
through web browsers.
In order to develop Web application, one should be
well-conversant with ASP.NET technology.
6. The Usage of Web Applications
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
6
Web Applications serve the following fields:
Communication
Shopping
Searching
Education
Entertainment
7. What is ASP.NET?
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
7
ASP.NET is only one of many technologies that can
be employed to create dynamic web pages.
A technology to develop content-rich dynamic and
personalized websites.
Developing ASP.NET Web application is similar to
developing Widows applications.
The fundamental component of ASP.NET is the Web
Form.
An ASP.NET web application can have one or more
Web Forms.
8. How does ASP.NET work?
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
8
9. The Constituents of ASP.NET Application
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
9
Web Forms or .aspx Pages
A web page that the user view in the web browser.
A dynamic page that accesses server resources.
It provides the UI for the Web Application.
Code-behind pages
Pages associated with Web Forms and contain the server-side
code for the Web Form such as VB.NET, C#.NET, J# …ect.
Configuration files
XML file that defines the default settings for Web Application
and the Web Server.
10. The Constituents of ASP.NET Application
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
10
Global.asax file
The file contains the code required to respond to application-
level events that are raised by ASP.NET.
XML Web Service links
They allow Web Applications to send/receive the data from an
XML Web service.
Database Connectivity
It allows Web applications to transfer the date to/from
database sources.
Caching
It allows Web applications to return Web Forms and data
more quickly after the first request.
11. Basic Principle of ASP.NET
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
11
Developing ASP.NET bases on CLR shared by all
.NET Applications
Developers can write code in ASP.NET by using
programming language supported .NET framework
such as C#, VB.NET, … and some third party
language such as PERL, or COBOL.
ASP.NET use .NET framework as an infrastructure
so with the rich set of features of the .NET controls,
classes and tools can cut down the development
times.
12. ASP.NET Coding Techniques
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
12
The methodologies use for writing code in a Web
application.
ASP.NET supports two different code techniques:
Single-file page model: developers write code directly in the
Web Form.
Code-behind page model: developers write code on another
page for the Web Form.
13. Single-File Page Model
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
13
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">
Protected Sub Button1_Click(ByVal sender As Object,
ByVal e As System.EventArgs)
Label1.Text = "Hello " & Textbox1.Text
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Simple Page</title>
</head>
<body>
<form id="form1" runat="server">
What is your name?<br />
<asp:Textbox ID="Textbox1" Runat="server"></asp:Textbox><br />
<asp:Button ID="Button1" Runat="server" Text="Submit" OnClick="Button1_Click" />
<p><asp:Label ID="Label1" Runat="server"></asp:Label></p>
</form>
</body>
</HTML>
14. Code-Behind Page Model
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
14
< %@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" % >
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" >
< html xmlns="http://www.w3.org/1999/xhtml" >
< head runat="server" >
< title > Simple Page < /title >
< /head >
< body >
< form id="form1" runat="server" >
What is your name? < br / >
< asp:Textbox ID="Textbox1" Runat="server" > < /asp:Textbox > < br / >
< asp:Button ID="Button1" Runat="server" Text="Submit" OnClick="Button1_Click" / >
< p > < asp:Label ID="Label1" Runat="server" > < /asp:Label > < /p >
< /form >
< /body >
< /html > Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles
Button1.Click
Label1.Text = "Hello " & TextBox1.Text
End Sub
End Class
.aspx Code page
.aspx.vb Code page
15. Code Declaration Blocks
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
15
Code declaration blocks are used to
define the sections of sever-side code
that is embedded in
The global.asax file within the <script>
blocks and
Set the attribute runat=“server”.
16. Getting start with ASP.NET
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
18
To start experiencing ASP.NET, all you have to do is
open Visual Studio and create a new web project. In
this first part, we’re going to use Web Forms as our
model.
ASP.NET pages contain server controls, namely
objects. A server control is a server-side
programmable piece of a page.
A Web Form is usually composed of two files
A markup file : refers to a designing page
A code file : is commonly referred to as code behind or code
beside
17. Getting start with ASP.NET
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
19
ASP.NET provides a transparent mechanism to handle
page compilation.
The first time a user requests a page, if it’s not yet
compiled, both the page and its code are grouped and
compiled to disk. What happens next is similar to what
happens for other requests: the page is instantiated,
rendered, and served in the browser as HTML. This
process is completely transparent to the developer.
ASP.NET continuously watches the file and, in case of
modifications, automatically discards the old version.
The new version is compiled instead, using the
previously exposed flow.
18. Getting start with ASP.NET
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
20
19. Typical Architecture in ASP.NET
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
21
20. Starting Visual Studio 2012
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
22
=> Start => All Programs => Microsoft Visual Studio 2012
21. Creating a new Web Application with
Visual Studio 2012
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
23
=> File => New => Web Site
22. Creating a new Web Application
with Visual Studio 2012
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
24
=> You will see a window looks like
23. First New Web Site with
Visual Studio 2012 Looks Like
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
25
The default web page look like
24. Creating a New Web page for the Web Site
with Visual Studio 2012
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
26
File => New => File
The below Window will appears:
25. Visual Studio 2012 Environment
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
27
Server Explorer
for
Database
Connection
To show code-design page
ToolBox for
Designing
To show Design Form
Solution Explorer to
show all pages
Properties window
to set properties
To run the Web Page
26. First Program with ASP.NET
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
28
The Web page below, you will design an .aspx page
with
A TextArea name txtName
A Label named lblWelcome
A Button named btnOK
When the Page load, you have to enter your name
into the TextBox.
After that, you click on the Button. Then the label
will display the welcome sentence.
29. Solving Problem
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
31
3. Add the page controls using ToolBox and Set properties
- TextBox
o ID : txtName
o BackColor : Light Yellow
o ForeColor : Blue
- Label
o ID : lblWelcome
o Text :
o BackColor : Light Orange
o ForeColor : Dark Red
- Button
o ID : btnOK
o Text : OK
30. Solving Problem
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
32
4. Write code for the Button to display the welcome
sentence in the label.
Double click on the button on the .aspx design page to
write behind code on .aspx.vb code page. Then write code as
below.
31. Running the Web Page
6/17/2013SETEC Institute [Web Development with
ASP.NET , prepare by ASP.NET Lecturer Team.]
33
Run the Web page and enter the name Click on “OK”.
33. Summary
6/17/2013SETEC Institute [Web Development with ASP.NET , prepare by ASP.NET Lecturer Team.] 35
1. ASP.NET is not a programming language but is a dot net
technology for Internet Programming.
2. ASP.NET is a powerful for developing aWebApplication.
3. Web page is a page or form in a website.
4. Web application is a web site containing as many pages and
data stored in a database.
5. Contents of dynamic web application are normally stored in
a database that can be loaded to the page and the page
contain only controls.
6. Visual Studio is an IDE for all the Microsoft .Net framework
form and window development.
34. Review Questions
6/17/2013SETEC Institute [Web Development with ASP.NET , prepare by ASP.NET Lecturer Team.] 36
1. What and Why ASP.NET?
2. What are the three layer technology?
3. What is a web page? a web site? an web
application?
4. How to create a new web site? a new web page?
5. What are the constituents of ASP.NET?
6. What are the two coding techniques supported by
ASP.NET 4.0?