ASP.NET - UTPA Faculty Web

adhocjackpotΑσφάλεια

5 Νοε 2013 (πριν από 4 χρόνια και 1 μήνα)

112 εμφανίσεις

DR.JOHN ABRAHAM

PROFESSOR

UTPA

ASP.NET


ACTIVE SERVER PAGES (ASP)


Web application development environment


Web applications use web browser to display


Extensible hyperText Markup Language (XHTML)


Client side scripting and server side scripting

What is ASP


ASP.NET is a Microsoft Technology


ASP stands for Active Server Pages


ASP.NET is a program that runs inside IIS


IIS (Internet Information Services) is Microsoft's Internet
server


IIS comes as a free component with Windows servers


IIS is also a part of Windows 2000 and XP Professional

Slide from w3schools

Multitier Application Architecture


Web based applications are multi
-
tier as functionality is
divided into tiers, each tier may reside on different machines
(or all on the same machine)


Data tier (bottom tier)


usually a RDBMS


Middle tier (business logic)


ASP.NET (web Server)


Top tier (user interface)


Browser

Web Forms


Web applications written in ASP use special Web pages called
Web forms.


Web form has .aspx file extension.


The source code for a web form is stored in a related file
called code
-
behind file with file extension aspx.vb (this part
contains the program logic)

What is an ASP.NET file?


An ASP.NET file is just the same as an HTML file


An ASP.NET file can contain HTML, XML, and scripts


Scripts in an ASP.NET file are executed on the server


An ASP.NET file has the file extension ".aspx"

Slide from w3schools

ASPX file & VB file created by ASP

1. Creates an
aspx

file that contains XHTML code that contains
runat

= “server”

Also code for creating controls are added.


2. Also creates VB code



Partial Public Class _Default



Inherits
System.Web.UI.Page



Protected Sub
Page_Load
(
ByVal

sender As Object,
ByVal

e
As
System.EventArgs
) Handles
Me.Load



lblTime.Text

=
Now.ToString
("
hh:mm:ss
")



End Sub


End Class

At run time



When a browser requests an HTML file, the server returns
the file


When a browser requests an ASP.NET file, IIS passes the
request to the ASP.NET engine on the server


The ASP.NET engine reads the file, line by line, and executes
the scripts in the file


Finally, the ASP.NET file is returned to the browser as plain
HTML

Some example code


In class demo

Creating a web application


From file choose new website, then asp.net website.


Set location to file system and browse to where you want to
create it.


Choose language and press OK


A web page named default.aspx is automatically created


Behind code also is created with the .vb extension


Right clicking will allow you to go to design mode


At the bottom of the page you can choose between design
and source code.

Coding


Change the title of the page: In the source, change the title
from untitled to whatever you want.


Now we will change the following body:

<body>


<form id="form1" runat="server">


<div>




</div>


</form>

</body>

Body Coding

<body>


<form id="form1" runat="server">


<div>


<h2> Current Time on the Web Server:</h2>


<p>


<asp:Label ID="lblTime" runat ="server" BackColor = "Blue"
EnableViewState="false"


font
-
size="XX
-
Large" ForeColor="Yellow"></asp:Label>


</p>


</div>


</form>

</body>