CSIS 3760 Supplement - ASP.NET Introduction

rangaleclickSoftware and s/w Development

Nov 4, 2013 (4 years and 7 months ago)



3760 Supplement

ASP.NET Introduction

ASP.NET is one section of a group of technologies called the .NET Framework. This
framework was designed from the ground
up to revolutionize the way developers program in the
windows environment.

Its main goal

was to provide a uniform, fast, and common means to develop applications. It
allows you to use multiple languages at the same time, as well as have the same functionality in
each language. Two examples of this common functionality are function overloadi
ng and
inheritance. Function overloading is having the same function,

with different parameter types,
eritance will let you “build” upon base classes that might already exist, extending their
functionality without having to completely re
write the objec
t. These were not available in all
languages in the Visual Studio 6.0 Suite, however in the .NET

even Visual Basic
contains these features to make it a complete language.

The structure of .NET is based on a series of classes that are built arou
nd a CLR, or Common
Language Runtime. All code, no matter what language it is written in, is compiled to the same
intermediate code, like a c++ object file, that is interpreted by the CLR. This structure, even
though Microsoft won’t admit it, closely res
embles Java.

ASP.NET also has had radical changes, and is not actually considered an upgrade from ASP, but
a new product version 1.0. It more closely resembles Visual Basic in it’s programming style and
utilizes a server
side event driven structure calle
d code
behind, where all server
side code
resides in a separate file in its own class structure that gets compiled to a runtime. When a web
page is called and an event is fired, the web page reloads, calling the corresponding server
event. The front
end to these ASP.NET pages are called Web Forms, and resemble Visual Basic
Forms in how they operate.

With ASP.NET, language is no longer a limitation on how you write. Currently .NET supports
over 20 different programming languages. It comes pre
led with support for Visual Basic,
C++, and C# a new language introduced in the .NET language and is a combination of Java and
C++ in structure. Another Microsoft created language for .NET is J#, which is the Java
reincarnation from Visual Studio 6.0, all

other languages are provided by third party vendors.
With this you can have multiple developers writing modules in multiple languages all running in
the same application, such as the case with ASP.NET where you can have a script block of

COBOL Example

All code in the .NET Framework is divided into namespaces, which is a logical organization for
class structures. The core of the .NET framework is the System namespace from which
everything is derived. Some examples are System.Data and Sys
tem.Web. Besides the
framework having a namespace, each application has its own namespace, which defaults to the
name of the application.

Installation of the .NET framework is very simple and is packaged into a single executable.
Keep in mind, howeve
r that .NET is NOT supported on Windows 9x, NT or ME. And it comes
installed in Windows XP. This one executable will install the framework, including
ASP.NET, code samples and documentation.

ASP.NET builds upon the ASP, but dramatically redefines

how the structure is used. For one,
ASP applications were built from the top
down, pages with server
side code were essentially one
big function that executed as it rendered the page, therefore logic in a web page was dependent
of where the code was bein
g rendered in the web page. ASP.NET however is event driven and
responds to server
side controls, which render as client
side objects, however respond to events
and contain server
side functions to handle these events.

These controls, called webcontrol
s, closely resemble Visual Basic controls and contain
properties and methods. Also, these controls as well as the whole ASP.NET framework, is not
Browser dependent. As a page loads on a browser, .NET determines what type of browser it is
and renders the
page accordingly. Code rendered to an IE browser might use DIV tags and
absolute positioning to display data, whereas the same page on a Netscape browser, would render
the page within a table structure having rows and columns of varying widths and heights

mimic the functionality of absolute positioning.

As mentioned before, code in an ASP.NET page defaults to being rendered into a separate web
page, unlike ASP where it was mixed with the web page. This method is called Code Behind
and has a complete
separation of server
side and client
side code. With this, all code is stored in
a class file ending in a .aspx.vb extension and is referenced by the following line in the aspx
<%@Page Language=”VB” Inherits=”ClassName” Src=”ClassName.aspx.vb” %>

is line is placed in the first line of an ASPX document.

However, ASP.NET can combine the HTML and Server
side code, such as in ASP, with a
method called Code Inline. With this model, code is still held within the aspx page, however is
not mixed in with
the HTML Code.

Another change in ASP.NET is how state is managed. It contains a feature called a “state bag”
where the data in almost all webcontrols are automatically saved and retrieved in between calls
to the server. This way you can process server
ide code without loosing any current
information. This also provides you with a method called Page.IsPostback, which can be
checked in the page load function to that you don’t load something twice. It is a Boolean value
that returns false the first time
a page is loaded, and true for all subsequent refreshes.