0% found this document useful (0 votes)
18 views83 pages

MWT Unit1

Middle ware Technologies
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views83 pages

MWT Unit1

Middle ware Technologies
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 83

Middleware Technologies

Introduction
What is a web form?

- A web form is a graphical user interface (GUI)


element that allows users to interact with a web
page or application.
- It typically consists of fields, buttons, and other
controls that enable users to input data, make
selections, or trigger actions.
- Web forms are used to collect user input, validate
data, and submit requests to a server.
- Examples: Login forms, contact forms, surveys,
and search boxes.
What is a web page?
- A web page is a single document or resource on
the web, identified by a unique URL.
- It typically contains content, images, videos, and
interactive elements like links, buttons, and
forms.
- Web pages are static or dynamically generated by
a server-side language like HTML, CSS,
JavaScript, and server-side programming
languages.
- Examples: Homepage, about page, product page,
or a blog post.
What is a Web Application?

- A web application is a collection of web pages, forms,


and other resources that work together to provide a
specific functionality or service.
- It is a software application that runs on a web server,
responding to user requests and interactions.
- Web applications can be built using various
technologies like HTML, CSS, JavaScript, and
server-side programming languages.
- Examples: Online banking systems, e-commerce sites,
social media platforms, and online productivity tools
like Google Docs.
Types of applications
1. Desktop applications:
• The apps which we are using in our computer
systems.
• We use this applications after them installing
Examples: notepad, ms word, vs code etc..
2. Mobile applications:
• These are the applications designed for mobile
phones(devices) after installation
Examples: Gmail, Facebook, Instagram etc..
3. Web apps:

• They are not installed in systems or mobiles


but only on a centralized server and then we
are going to consume these apps through
various devices and various locations with the
help of internet.
Example: web browser
Types of web applications
1. Static web applications:
UNIT-I TOPICS
• Introduction to Middleware
• Learning from the history of ASP
• reviewing the basics of ASP.NET platform
• How web servers execute ASP files
• Taking security precautions
• Understanding ASP.NET Core
• Handling requests with middleware
pipeline.
Introduction to Middleware
• Middleware serves as a crucial bridge in software
systems, facilitating communication between
different applications and services.
• By managing data exchange, application
services, integration, and simplifying complex
processes. middleware plays an essential role in
creating efficient, interconnected systems.
• Middleware acts as the translator, ensuring that all
components work together, even if they are built
on different technologies.
What is Middleware?
• Middleware handle various tasks such as data
translation, message queuing, authentication, and
connectivity, making it easier to integrate and
manage complex software environments.
• The middleware serves as the link between users,
data, and applications.
• Middleware typically handles authentication,
communications, data management, application
services, and application programming interface
(API) management.
Types
• Database middleware
• Web server middleware
• Message oriented middleware
• Cloud Services of all kinds,
• Enterprise application integration, and
• Application run times
Middleware technologies are commonly
used in various industries, including:
1. Enterprise software integration
2. Cloud computing and migration
3. Micro services architecture
4. IOT (Internet of Things) development
5. Real-time data processing and analytics
Middleware technologies offer numerous
benefits, such as:
1. Improved scalability and flexibility
2. Enhanced security and authentication
3. Simplified data integration and
processing
4. Reduced development time and costs
5. Increased reliability and fault tolerance
Learning from the history of ASP

• ASP stands for Active Server Pages


• ASP is a development framework for building web pages.
• ASP.NET was released in 2002 as a successor to Classic ASP.
• ASP.NET pages have the extension .aspx and are normally
written in C# (C sharp).
• First version Object-oriented Web application development
supporting inheritance, polymorphism and other standard OOP
features.
• ASP.NET 4.6 is the latest official version of ASP.NET.
• ASP.NET 5 was expected to be an important redesign of
ASP.NET.
• However, the development of ASP.NET 5 was stopped in favor
of ASP.NET Core.
Evolution of ASP.NET
Reviewing the basics of ASP.NET
platform
What is asp.net?
• ASP stands for Active Server Pages
• NET stands for Network Enabled Technologies
• Asp.net is used to develop websites, web
applications and web services.
• Asp.net is a free, open-source web framework
developed by Microsoft, allowing developers to
build dynamic web applications and web
services.
• ASP and ASP.NET are server side
technologies.
• Both technologies enable computer code to be
executed by an Internet server.
• When a browser requests an ASP or ASP.NET
file, the ASP engine reads the file, executes
any code in the file, and returns the result to
the browser.
• ASP.NET works on top of the HTTP protocol,
and uses the HTTP commands.
• It is built on the Common Language
Runtime (CLR) and allows programmers to
write code using any supported .NET
language.
Why ASP.NET
• With respective to building a web application
asp.net is much easier when compare to other
technologies like PHP & node.js
• It is much faster and more efficient then many
other languages.
• It produces interactive, data-driven web
applications on the internet.
Languages
• The ASP.NET application codes can be written
in any of the following languages:
➢ C#
➢Visual Basic.Net
➢Jscript
➢J#
ASP.NET architecture:
Tools of ASP.NET

• Microsoft web platform installer


• SQL complete
• Web essentials for visual studio
• Re-Sharper
Key Features of ASP.NET
1. State Management: provides various state
management options, such as Session State,
Application State, and View State.
2. Authentication and Authorization: Built-in support
for securing applications, using Windows
Authentication, Forms Authentication, and Azure
Active Directory.
3. Caching: provides caching mechanisms to improve
performance and reduce database queries.
4. Debugging and Diagnostics: Tools and features for
debugging, tracing, and monitoring applications.
Benefits of ASP.NET
1. Rapid Development: asp.net allows for rapid
development and deployment of web applications.
2. Easy Maintenance: asp.net makes it easy to
maintain and update web applications.
3. Scalability: asp.net allows web applications to scale
to meet the needs of a growing user base.
4. Security: asp.net provides a secure framework for
building web applications, including built-in
authentication and authorization.
5. Integration: asp.net integrates with other .NET
technologies, such as asp.net and Windows Forms.
6. Cross-Platform Compatibility: asp.net web
applications can run on multiple platforms, including
Windows, Linux, and mac OS.

7. Extensive Tooling: asp.net has extensive tooling,


including Visual Studio, which makes development
easier.
8. High Performance: asp.net provides high
performance and fast execution of web applications.
Characteristics of ASP.NET

1. Object-oriented: Built on top of the .NET


Framework, which is object-oriented.
2. Multi-language support: Supports multiple
programming languages, including C#, F#.
3. Event-driven: Uses an event-driven programming
model, where code is executed in response to events.
4. Server-side technology: Code is executed on the
server, generating HTML, CSS, and JavaScript.
5. Stateless: Each request is independent of the
previous one, making it a stateless technology.
6. Session state: Provides session state, allowing data to
be stored and retrieved for each user.

7. Caching: Provides caching, allowing frequently


accessed data to be stored in memory for faster
access.
8. Extensive tooling: Has extensive tooling, including
Visual Studio, which makes development easier.
9. Large community: Has a large and active
community of developers, providing many resources.
Difference between ASP and ASP.NET
ASP ASP.NET

1. ASP is the interpreted 1. ASP.NET is the compiled


language. language.
2. ASP uses ADO (ActiveX 2. ASP.NET uses ADO.NET to
Data Objects) technology to connect and work with
connect and work with databases.
databases.
3. ASP is partially object- 3. ASP.NET is fully object-
oriented. oriented.
4. In ASP there is no facility to
4. In ASP.NET it has the option
separate design from
of Code Containment.
programming logic.
ASP ASP.NET

5. ASP doesn’t have the concept 5. ASP.NET inherit the class


of inheritance. written in code behind.

6. ASP pages use scripting 6.ASP.NET uses a full-fledged


language. programming language.

7. Error handling is very poor in 7. Error handling is very good in


ASP. ASP.NET.
8. ASP Pages have the file 8. ASP.NET Pages have the file
extension .asp. extension .aspx.
.NET framework Architecture
• It is a virtual machine that provide a common
platform to run an application that was built
using the different language such as C#,
VB.NET, Visual Basic, etc.
• The .Net Framework architecture is a multi-
layered, modular, and extensible
architecture that enables building web
applications, web services, and dynamic web
content.
• The main objective of this framework is to
develop an application that can run on
the windows platform.
• The architecture is designed to be
flexible, scalable, and maintainable,
allowing developers to build robust and
high-performance web applications.
• The current version of the .Net
framework is 4.8.
• This is a high-level overview, and each
layer and component has more depth and
complexity
Components of .NET framework
1. Common Language Runtime or CLR:
• CLR is the runtime environment in the .NET
Framework that manages the execution of .NET
code.
• The CLR is responsible for loading, executing,
and managing .NET assemblies, which contain
the compiled code.
• It acts as an abstraction layer between the .NET
code and the underlying operating system and
hardware, enabling platform independence and
cross-language integration.
• CLR also helps to convert a source code
into the byte code, and this byte code is
known as CIL (Common Intermediate
Language) or MSIL (Microsoft
Intermediate Language).
• After converting into a byte code, a CLR
uses a JIT compiler at run time that helps
to convert a CIL or MSIL code into the
machine or native code.
Common Language Runtime
It provides various services, including:
• Memory Management
• Type Safety
• Exception Handling
• Security
• Interoperability
• Just-In-Time (JIT) Compilation
• Thread Management
• Debugging and Profiling
1. Memory management: Automatic memory
allocation and garbage collection.
2. Type safety: Ensures type correctness and
prevents type-related errors.
3. Exception handling: Provides a framework
for handling runtime errors.
4. Security: Enforces security policies and
permissions.
5. Interoperability: Allows .NET code to interact
with .Net code.
5. JIT (Just-In-Time) compilation: Compiles
.NET code into native machine code.
6. Threading: Supports multithreading and
concurrency.

7. Debugging: Provides tools and APIs for


debugging .NET applications.
2. CLS (Common language
Specification)

• It is a subset of common type system (CTS)


that defines a set of rules and regulations
which should be followed by every language
that comes under the .net framework.
• In other words, a CLS language should be
cross-language integration or interoperability.
Examples CLS

• For example, in C# and VB.NET language, the


C# language terminate each statement with
semicolon, whereas in VB.NET it is not end
with semicolon, and when these statements
execute in .NET Framework, it provides a
common platform to interact and share
information with each other.
3. FCL (Framework Class Library)

• It provides the various system functionality in


the .NET Framework, that includes classes,
interfaces and data types, etc. to create
multiple functions and different types of
application such as desktop, web, mobile
application, etc.
• In other words, it can be defined as, it
provides a base on which various applications,
controls and components are built in .NET
Framework.
Key Components of FCL

1. Object type
2. Implementation of data structure
3. Base data types
4. Garbage collection
5. Security and database connectivity
6. Creating common platform for window and
web-based application
4. C#: The primary programming language used for
(asp.net) development.

5. Visual Studio: The popular IDE (Integrated


Development Environment) for building,
debugging, and deploying applications.
6. Visual Basic

• Visual Basic (VB) is a programming language


developed by Microsoft in 1992. The purpose of this
language is to develop an application that can run on
different versions of the Windows operating system.
• A Visual Basic evolved from Basic Language; Basic
language is easier to read than other languages. The
final version of Visual Basic was released in 1998.
• Microsoft then launched a Visual Basic Dot Net
('VB.NET') language, which is much better than
Visual Basic in all aspects such as performance,
reliability, working environment, easy to build, and
debugging an application.
Characteristics of .NET Framework
• CLR (Common Language Runtime)
• Namespace - Predefined class and function
• Metadata and Assemblies
• Application domains
• It helps to configure and deploy the .net application
• It provides form and web-based services
• NET and ASP.NET AJAX
• LINQ
• Security and Portability
• Interoperability
• It provides multiple environments for developing an
application
ASP.NET MVC

• Aps.net MVC (Model-View-Controller) is a


web application framework developed by
Microsoft, which implements the MVC
pattern.
• It allows developers to build web applications
using a modular, scalable, and maintainable
architecture.
ASP.NET MVC

• the MVC (Model-View-Controller)


design pattern has actually been around
for a few decades, and it's been used
across many different technologies.
• A design pattern for achieving a clean
separation of concerns
ASP.NET MVC

• Using this pattern, user requests are


routed to a Controller which is
responsible for working with the Model
to perform user actions and/or retrieve
results of queries.
• The Controller chooses the View to
display to the user, and provides it with
any Model data it requires.
ASP.NET MVC

The MVC (Model-View-Controller) is an


application development pattern or design
pattern which separates an application
into three main components:
• Model
• View
• Controller
Request Flow in MVC Architecture
Model: Model represents the shape of the data.
A class in C# is used to describe a model. Model
objects store data retrieved from the database.

View: View in MVC is a user interface. View


display model data to the user and also enables
them to modify them. View in ASP.NET MVC
is HTML, CSS, and some special syntax
(Razor syntax) that makes it easy to
communicate with the model and the
controller.
Controller: The controller handles the user
request. Typically, the user uses the view and
raises an HTTP request, which will be handled
by the controller. The controller processes the
request and returns the appropriate view as a
response.
How web servers execute ASP files

• When a site visitor requests a Web page address, the


browser contacts the Web server specified in the address
URL and makes a request for the page by formulating a
HTTP request, which is sent to the Web server.
• The Web server on receiving the request determines the file
type requested and passes processing to the
appropriate handler.ASP.NET files are compiled, if
necessary, into .NET Page classes and then executed, with
the results sent to the client’s browser.
• Compilation means that on first load ASP.NET applications
take longer to display than previous versions of ASP, but
once compiled they are noticeably faster.
Client-Server Interaction

• ASP.NET applications are a mixture of client side


markup and code, and server side processing.
When an ASP.NET Web form page is downloaded
to the visitor’s Web browser, additional code is
included to previous ASP versions.
• This extra code enables richer form functionality,
including server and client side events, validation,
and the ability to maintain form value state. The
server determines the visitor’s browser type and
sends markup to match the browser’s abilities.
Figure1: How the Client and Server
Communicate
Server-Side Processing

• When the server receives this request, it will


find the page that was requested using the path
information specified, and the relevant system
will process the page. In the case of Classic
ASP, there was not much to this process,
although a certain amount of caching
happened. As you will see in Figure 2,
with ASP.NET the process is a fair amount
more involved but provides for much faster
processing and delivery.
• Figure2 the Server-Side Compilation and
Delivery Process
Figure 3 Major Steps in Serving an
ASPX Page
A web server executes an ASP file (Active
Server Pages) in the following steps:

1. Request: A client (browser) sends a request to


the web server for an ASP file.
2. Parsing: The web server (e.g., IIS - Internet
Information Services) parses the ASP file to
identify server-side code.
3. Compilation: The server-side code is
compiled into an executable format
4. Instantiation: An instance of the ASP page is
created, and the compiled code is executed.
5. Execution: The ASP code is executed on the
server, generating HTML, CSS, and JavaScript
content.
6. Rendering: The generated content is rendered
to the client (browser) as a web page.

7. Cleanup: The ASP page instance is destroyed,


and resources are released.
During execution, ASP code can:

- Access databases
- Perform server-side logic
- Interact with components (e.g., COM, .NET)
- Use server-side includes (SSI)

The web server manages the entire process,


ensuring efficient and secure execution of ASP
files.
ASP.NET page life cycle

ASP.NET life cycle specifies, how:


➢ASP.NET processes pages to produce
dynamic output
➢The application and its pages are
instantiated and processed
➢ASP.NET compiles the pages
dynamically
The ASP.NET life cycle could be
divided into two groups:
1. Application Life Cycle
2. Page Life Cycle
1. Application Life Cycle

- Application Start: The web server processes


the first request and creates an instance of
Application Manager and Hosting Environment
classes.
- Object Creation: The web server creates
instances of HttpContext, HttpRequest, and
HttpResponse classes.
- HttpApplication Creation: The web server
creates an instance of HttpApplication class to
process subsequent requests.
2. Page Life Cycle

• In ASP.NET, a web page has execution


lifecycle that includes various phases.
• These phases include initialization,
instantiation, restoring and maintaining state
etc.
• it is required to understand the page lifecycle
so that we can put custom code at any stage to
perform our business logic.
• Asp.net page life cycle has specific
steps that carried out during
execution
• These phases include initialization ,
restoring, & execution.
page life cycle phases:
1.Page Request:
• When the user requests a page, the server
checks the requests & then compiles the
page & response to the user. Or
• When the page is requested by user the
caching, parsing and compiling is
determined by asp.net.
• The page request occur before page cycle
page life cycle phases

2. start: at this stage the request and


response objects are set.
3. Page Initialization: Controls are
instantiated, and themes are applied.
page life cycle phases
4. Load: Control properties are set using
view state and control state values.
5.Validation: Validation controls are
executed, and the Is Valid property is set.
6. Postback Event Handling: Event
handlers for postback events are
executed.
page life cycle phases

7. Page Rendering: View state is


saved, and the page is rendered.
8. Unload: The page is unloaded, and
resources are released.
ASP Server.Execute method:

• The Server.Execute method in ASP (Active


Server Pages) is used to execute a separate ASP
file or a specified block of code on the server.
This method allows you to:
1. Include the output of another ASP file in the
current page.
2. Execute a specific section of code without
terminating the current page.
3. Reuse code from another ASP file.
Taking security precautions
Here are some essential security precautions:
1. Validate user input: Use server-side validation to prevent
SQL injection and cross-site scripting (XSS) attacks.

2. Use secure authentication: Implement secure


authentication mechanisms, such Identity or OAuth, to protect
user accounts.

3. Authorize user access: Use role-based authorization to


restrict access to sensitive data and functionality.

4. Encrypt sensitive data: Use SSL/TLS encryption to protect


data in transit and consider encrypting sensitive data at rest.
5. Use secure protocols: Use secure communication
protocols, such as HTTPS, to protect data in
transit.
6. Keep software up-to-date: Regularly update ,
.NET Framework, and other dependencies to
ensure you have the latest security patches.
7. Use a Web Application Firewall (WAF):
Consider using a WAF to detect and prevent
common web attacks.
8. Monitor and log security events: Regularly monitor
and log security-related events to detect potential
security issues.
9. Implement error handling: Implement proper error
handling to prevent information disclosure and
maintain application stability.
10. Regularly perform security testing: Perform
regular security testing and vulnerability assessments to
identify and address potential security issues.
ASP.NET Core
• ASP.NET Core is the modern, high-
performance web development framework
for .NET, that runs on Windows, Linux, macOS
• ASP.NET Core was first released in 2016 and is
a re-design of earlier Windows-only versions
of ASP.NET.
• ASP.NET Core is redesign of asp.net 4.x

You might also like