Sunteți pe pagina 1din 36

Dynamic Site

(An Active Server Pages)

Madiha Kiran

1
DOT-NET is the technology
• .NET
• .NET is a free, cross-platform, open source developer platform for building
many different types of applications.
• The .NET is the technology from Microsoft, on which all other Microsoft
technologies will be depending on in future.
• It is a major technology change, introduced by Microsoft, to catch the
market from the SUN's Java.

2
DOT-NET is the technology
• Few years back, Microsoft had only VC++ and VB to compete with Java, but
Java was catching the market very fast.
• With the world depending more and more on the Internet/ Web
and java related tools becoming the best choice for the web applications,
Microsoft seemed to be loosing the battle.

• To recover the market, Microsoft announced .NET.


• Microsoft has a wonderful history of starting late but catching up quickly.

3
.NET is also called Microsoft strategy
• Microsoft introduced the .NET considering multiple factors.
• All unwanted complexities are eliminated
• and a pure object oriented programming model was introduced.
• This makes programmer's life very easy.
• .NET is said to be Microsoft development model in which software becomes
platform and device independent and data becomes available over the internet.
• Due to this vision Microsoft .NET is also called Microsoft strategy for connecting
systems, information and devices through web services so people can
collaborate and communicates effectively.

4
.NET

5
What is ASP.NET
• ASP.NET An Active Server Page (ASP)
• Microsoft ASP.NET is a framework used in web application development,
dynamic websites and web services.
• A framework for developing next generation websites, web applications and
web services.

• There have been 6 frameworks so far since this technology was created: 1.0,
1.1, 2.0, 3.5, 4.0 and the current version 4.5.
• Every framework has been adding more and more classes, methods, types,
etc., so programmers are able to do more things using these new features.
6
C sharp ( C#)
• C# is an object-oriented programming language developed by
Microsoft as part of the .NET framework.
• A C# web application will run on the Windows ecosystem and there is
a lot that can be leveraged for a powerful, seamless experience

7
integrated development environment (IDE)
• An integrated development environment (IDE) is a software suite that
consolidates basic tools required to write and test software.
• Developers use numerous tools throughout software code creation,
building and testing. Development tools often include text editors, code
libraries, compilers and test platforms.
• Without an IDE, a developer must select, deploy, integrate and manage all
of these tools separately. An IDE brings many of those development-related
tools together as a single framework, application or service. The integrated
toolset is designed to simplify software development and can identify and
minimize coding mistakes and typos.
• Some IDEs are open source, while others are commercial offerings. An IDE
can be a standalone application or it can be part of a larger package.
8
Microsoft Visual Studio
• Microsoft Visual Studio is an integrated development environment
(IDE) from Microsoft.
• It is used to develop computer programs, as well as websites, web
apps, web services and mobile apps.
• Visual Studio uses Microsoft software development platforms such as
Windows API, Windows Forms, Windows Presentation Foundation,
Windows Store and Microsoft Silverlight. It can produce both native
code and managed code.
• It supports different programming languages like C#, as well as Visual
Basic, C, C++, and provides support for Python and Ruby

9
Overview
• Net is a framework and a class library
• ASP.net is a web application development platform, also called a
framework and class library for creating web apps.
• C# is language which can be used for developing applications.
• while Visual Studio is an IDE, which supports ASP.NET and C# and many
others

10
Web Development Technologies

 Client-side technologies
 HTML, DHTML, JavaScript
 Server-side technologies
 ASP (Active Server Pages)
 ASP.NET is the next generation of ASP

11
Slide6of72
What is ASP?

 Server-side programming technology


 Consists of static HTML interspersed with script
 ASP intrinsic objects (Request, Response, Server, Application,
Session) provide services
 Commonly uses ADO(Active data Object) to interact with
databases
 Application and session variables
 Application and session begin/end events
 ASP manages threads, database connections, ...
12
Slide7of72
What is ASP?

HTTP request HTTP response


(form data, HTTP HTML, XML
header data)

ASP page
(static HTML,
server-side logic)

13
Slide8of72
Background
Demo: HelloWorld.asp

<html>
<head><title>HelloWorld.asp</title></head>
<body>
<form method=“post">
<input type="submit" id=button1 name=button1
value="Push Me" />
<%
if (Request.Form("button1") <> "") then
Response.Write("<p>Hello, the time is " & Now())
end if
%>
</form>
</body>
</html>
14
Slide9of72
ASP Successes

 Simple procedural programming model


 Access to COM components
 ActiveX Data Objects (ADO)
 File System Object
 Custom components
 Script-based: no compiling, just edit, save & run
 VBScript, JScript – leverages existing skills
 Support for multiple scripting languages
 ASP has been very popular
15
Slide10of72
ASP Challenges

 Coding overhead (too much code)


 Everything requires writing code!
 Code readability (too complex; code and UI intermingled)
 Maintaining page state requires more code
 Reuse is difficult
 Supporting many types of browsers is difficult
 Deployment issues (e.g. DLL locking)
 Session state scalability and availability
 Limited support for caching, tracing, debugging, etc.
 Performance and safety limitations of script
16
Slide11of72
ASP.NET Goals

 Keep the good parts of ASP and improve the rest


 Simplify: less code, easier to create and maintain
 Multiple, compiled languages
 Fast
 Scalable
 Manageable
 Available
 Customizable and extensible
 Secure
 Tool support
17
Slide14of72
ASP.NET
Key Features

 Web Forms  Session management


 Web Services  Caching
 Built on .NET Framework  Debugging
 Simple programming  Extensibility
model  Separation of code and UI
 Maintains page state  Security
 Multibrowser support  ASPX, ASP side by side
 XCOPY deployment  Simplified form validation
 XML configuration  Cookieless sessions
 Complete object model
18
Slide15of72
ASP.NET Architecture

VB C++ C# JScript …

Visual Studio.NET
Common Language Specification
ASP.NET: Web Services Windows
and Web Forms Forms
ADO.NET: Data and XML

Base Classes

Common Language Runtime

19
Slide18of72
Approaches
Asp .Net supports three approaches to build web sites.
1. Web pages using web matrix
2. MVC
3. Web form

20
web matrix

• WebMatrix is a set of tools that provides an easy way to build Web sites
for Microsoft Windows.
• It includes
• a development web server: IIS Express (Internet Information Server )
• a web programming framework : ASP.NET
• an embedded database : SQL Server

Note: WebMatrix is no longer recommended as an integrated development


environment (IDE)

21
MVC

• The Model-View-Controller (MVC) is an architectural pattern that


separates an application into three main logical components:
the model, the view, and the controller. Each of these components
are built to handle specific development aspects of an application.
• MVC is one of the most frequently used industry-standard web
development framework to create scalable and extensible projects.

22
MVC
• Model
The Model component corresponds to all the data-related logic that the user works with. This can
represent either the data that is being transferred between the View and Controller components or
any other business logic-related data. For example, a Customer object will retrieve the customer
information from the database, manipulate it and update it data back to the database or use it to
render data.
• View
The View component is used for all the UI logic of the application. For example, the Customer
view will include all the UI components such as text boxes, dropdowns, etc. that the final user
interacts with.
• Controller
Controllers act as an interface between Model and View components to process all the business
logic and incoming requests, manipulate data using the Model component and interact with the
Views to render the final output.
For example, the Customer controller will handle all the interactions and inputs from the Customer
View and update the database using the Customer Model. The same controller will be used to view
the Customer data.

23
MVC

24
Web form

• ASP.NET Web Forms is a web application framework and one of


several programming models supported by the
Microsoft ASP.NET technology.
• Web Forms applications can be written in any programming language
which supports the Common Language Runtime, such as C# or Visual
Basic.

25
ASP.NET Programming Model
Controls and Events

Button code
Button ...

List code
List ...

Text code
Text ...

Browser ASP.NET Event handlers

26
Slide21of72
Programming Model
ASP.NET Object Model

 User code executes on the web server in


page or control event handlers
 Controls are objects, available in
server-side code
 Derived from System.Web.UI.Control
 The web page is an object too
 Derived from System.Web.UI.Page which is a
descendant of System.Web.UI.Control
 A page can have methods, properties, etc.

27
Slide22of72
Programming Model
Postbacks Maintain State

 By default, ASP.NET maintains the state of all


server-side controls during a postback
 Can use method="post" or method="get"
 Server-side control objects are automatically
populated during postback
 No state stored on server
 Works with all browsers

28
Slide24of72
Programming Model
Postbacks Maintain State

 By default, ASP.NET maintains the state of all


server-side controls during a postback
 Can use method="post" or method="get"
 Server-side control objects are automatically
populated during postback
 No state stored on server
 Works with all browsers

29
Slide24of72
Programming Model
Server-side Controls

 Multiple sources of controls


 Built-in
 3rd party
 User-defined
 Controls range in complexity and power: button,
text, drop down, calendar, data grid, ad rotator,
validation
 Can be populated via data binding

30
Slide25of72
Programming Model
Automatic Browser Compatibility

 Controls can provide automatic browser


compatibility
 Can target UpLevel or DownLevel browsers
 UpLevel browsers support additional functionality,
such as JavaScript and DHTML
 DownLevel browsers support HTML 3.2

31
Slide26of72
Programming Model
Automatic Browser Compatibility
IE 4
Button

Menu

Text

Netscape Button Control Button code


Button ...
Menu

Text
Menu Control Menu code
...
IE 5.5
Button
Text Control Text code
Menu

Text
...

IE 6
Button

Menu ASP.NET Event handlers


Text

... 32
Slide27of72
Programming Model
Code-behind pages

 Two styles of creating ASP.NET pages


 Controls and code in .aspx file
 Controls in .aspx file, code in code-behind page
 Supported in Visual Studio.NET
 Code-behind pages allow you to separate the
user interface design from the code
 Allows programmers and designers to work
independently
<%@ Codebehind=“WebForm1.bas”
Inherits=WebApplication1.WebForm1” %>
33
Slide28of72
Programming Basics
Page Syntax
 The most basic page is just static text
 Any HTML page can be renamed .aspx
 Pages may contain:
 Directives: <%@ Page Language=“VB” %>
 Server controls: <asp:Button runat=“server”>
 Code blocks: <script runat=“server”>…</script>
 Data bind expressions: <%# %>
 Server side comments: <%-- --%>
 Render code: <%= %> and <% %>
 Use is discouraged; use <script runat=server> with code in
event handlers instead

34
Slide32of72
Programming Basics
The Page Directive

 Lets you specify page-specific attributes, e.g.


 AspCompat: Compatibility with ASP
 Buffer: Controls page output buffering
 CodePage: Code page for this .aspx page
 ContentType: MIME type of the response
 ErrorPage: URL if unhandled error occurs
 Inherits: Base class of Page object
 Language: Programming language
 Trace: Enables tracing for this page
 Transaction: COM+ transaction setting
 Only one page directive per .aspx file

35
Slide33of72
Programming Basics
Server Control Syntax

 Controls are declared as HTML tags with


runat=“server” attribute
<input type=text id=text2 runat=“server” />
<asp:calendar id=myCal runat=“server” />

 Tag identifies which type of control to create


 Control is implemented as an ASP.NET class
 The id attribute provides programmatic identifier
 It names the instance available during postback
 Just like Dynamic HTML
36
Slide34of72

S-ar putea să vă placă și