The Web Architecture and ASP.NET

Download Report

Transcript The Web Architecture and ASP.NET

The Web Architecture
and ASP.NET
Review of the Web (1)

It began with HTTP and HTML, which delivers
static Web pages to browsers which would
render those pages
Browser
HTTP Request
HTTP Response
(Web page)
Web Server
Review of the Web (2)

Scripting languages were created to execute
client code within the context of a browser
Browser
HTTP Request
Client code
(JavaScript)
(VBScript)
HTTP Response
(Web page / code)
Web Server
Review of the Web (3)

Server-side applications were created to
execute code and dynamically generate Web
pages based on a particular request
Web Server
Browser
HTTP Request
Client
code
(script)
HTTP Response
(Web page / code)
Interpret
request
Generate
HTML and
script
Review of the Web (4)

And now we have AJAX / JSON making partial
page requests
Web Server
Browser
Client code
(Silverlight)
Client code
(script)
HTTP Request
Interpret
request
HTTP Response
(Web page / code)
Generate
HTML and
script
Execute AJAX
Request
The Great Client/Server
Debate

Where do we process?





Client or server
What get’s processed where?
And the interaction between client and server
Where does bandwidth fit into this equation?
Where does processing power (and latency)
fit into this equation?
And all the Related
Technologies


jQuery – yes it works with ASP
AJAX – ASP has some interesting AJAX
libraries



We can (AND WILL) write our own handlers for
those AJAX requests
Silverlight is a well-used client-side
framework part of RIA
(http://msdn.microsoft.com/enus/library/ee707344(v=vs.91).aspx)
Azure?
Current Client Technologies

And what browser (and version) do you
use?



Scripting details vary from browser to browser
DOM objects can vary a bit too
HTML5 and CSS3 support varies but is pretty
good
Current Server Technologies





Apache
WebSphere (IBM)
Oracle / Sun (doing ASP.NET, CGI and PHP)
Microsoft and IIS
HP and others have offerings


Largely based on Apache
In summary, there are quite a few
ASP.NET (History)

Introduced with the .NET Framework in 2002


ASP.NET 2.0 introduced in 2005 gave developers
enhanced database tools



It made Web development look like traditional
Windows development
This included desktop improvements too
MVC was introduced / much more later
ASP.NET 3.0 released with 2008
ASP.NET (History)

ASP.NET 4 released with Visual Studio 2010 and
version 4 of the Framework

Razor was introduced along with ASP.NET Web
pages



Web pages and Web Forms are different
There is an open-source movement (We will
see how this pans out)
Support for HTML 5 and CSS 3 is very good
ASP.NET (History)


Current version is Visual Studio 2013 and
Framework version 4.5.1
ASP.NET (Architecture)
What is a .NET Application (1)?

It looks and works surprisingly like Java
 Source code (VB, C#, etc.) is compiled into a
machine independent assembly language (MSIL
or IL)
 The executable file is called an assembly
 IL can be disassembled using the IL
Disassembler (ILDASM)
What is a .NET Application (2)?


MSIL is translated into native executable code via the
Just-in-Time (JIT) compiler
 It’s possible to precompile an application using the
Native Image Generator (Ngen)
All .NET applications run under the control of the
Common Language Runtime (CLR)
 We call this managed code
What is a .NET Application (3)?



On the desktop, the application runs under
the control of the Common Language
Runtime
With Respect to Web applications, all
execution is handled on the server (IIS)
http://msdn.microsoft.com/enus/library/bb470252.aspx
The ASP.NET Runtime


When IIS sees an .aspx file, it loads
aspnet_isapi.dll to create the Page object
Application behavior is controlled by
configuration files


Machine.config is the global machine
configuration file
Web.config allows you to override default
configuration items

Both are XML documents
Programming ASP.NET

Conceptually it’s much like the VB
programming you are used to



You create procedures in event handlers and
general procedures
You declare variables
Instead of a form, the primary user interface
is the WebForm
Current ASP Technologies

ASP Web Forms


ASP.NET MVC



It stands for Model-View-Controller
It’s an alternative to Web Forms
ASP.NET Web Pages (Razor)



Have been around for a while and have
continued to evolve
A more lightweight processing model
Looks a bit like PHP
Silverlight and RIA
ASP.NET Web Forms

Provides server-side tools for site navigation








Menus, Drill-down toolbars, breadcrumbs, etc.
Authentication tools
Database connections
Client and server executable code
State management and caching
Authentication and role management
Deployment tools
Robust development tools (Visual Studio)
ASP.NET Web Forms
(Introduction)
Client
(browser)
HTTP
Server
(IIS)
request
response
ASP Worker
Process
request
Generate client
page (HTML)
Web Forms and Stateful
Web Programming

Remember that the Web is stateless


Web servers to not persist state from one
request to the next
ASP.NET does allow stateful programming
though

various hidden fields and serialized data
server side session objects

Much more on state management later

Web Forms and
Event-Driven programming

ASP.NET, though serialization, simulates
event-driven programming

ASP.NET events differ significantly from
Windows Forms events
Introduction to the Web
Forms Component Model

Remember that .NET is an OOP environment
and ASP.NET is no exception




As the developer, you create .aspx pages that
make up a Web application
When executed, the .aspx page is compiled into
a custom class that inherits from
System.Web.UI.Page
As the developer, you can program against this
class just as you would program against any
class
It all happens on the server!
ASP.NET MVC

MVC is the acronym form Model-ViewController



It’s a design pattern coined by the GOF
It requires version 4 of the .NET Framework
It’s an alternative to traditional ASP.NET Web
forms
Web Matrix and Razor


A “lightweight” technology to create simple
Web sites
Requires version 4.0 of the .NET Framework
and a few add-ins
Silverlight

It run on a client (browser) and
communicates with a server via RIA services

Netflix?