SKILLWISE-ADVANCED
WEB APP DEVELOPMENT
HTTP PIPELINE
Life of an ASP.NET Request
• ASP.NET is layered on top of IIS5, IIS6
– IIS receives a request for a ASP.NET page
– aspnet_isapi.dll registered for ASP.NET extensions
– ISAPI extension passes request to worker process
aspnet_wp.exe (IIS 5) or hands request to ASP.NET within
w3wp.exe
– ASP.NET classes take over request
– When processing is complete, response is returned to IIS and
ultimately back to client
• ASP.NET is integrated into IIS7
– IIS receives a request for an ASP.NET page (.aspx)
– Request is dispatched to PageHandlerFactory by IIS (handler
associated with .aspx)
HttpPipeline Architecture (IIS 5)
HttpPipeline architecture (IIS
6)
HttpPipeline architecture
(IIS 7)
Inside the Pipeline
• Once inside the worker process, a
request goes through a series of steps
– It is first routed to the AppDomain
associated with that application
– A number of classes within the AppDomain
interact to service the request
• HttpRuntime
• HttpWorkerRequest
• HttpApplication
• HttpContext
• Modules
• Handlers
• ...
Classes in the HTTP Pipeline of ASP.NET
HttpContext
• ASP.NET request information
stored in HttpContext
– Unique instance created for each
request
– Stores all request-specific data
– Stores links to all relevant classes
(Application, Session, ...)
– Passed as a parameter to many
methods (ProcessRequest)
HttpContext Properties
Using HttpContext.Current
Applications
• The first point of extensibility in the pipeline is the
application
– The application class acts as initial entry point for a
request
– Serves as a repository of globally available resources
• application state
• cache
• session state
• Gives access to many important events that occur during
the lifetime of the application
• Always an instance or derivative of HttpApplication
• Accessible through HttpContext and Page classes
HttpApplication class
Customizing the Application Class
• You create a custom application by
writing a global.asax file
– Placed at the top-level of the virtual
directory
– Parsed and compiled into an assembly
on first access
– Creates a new class deriving from
HttpApplication
– Used in place of the default
application class
Sample global.asax file
HttpApplication events
Additional events available through global.asax
Custom Handlers
• Each .aspx file creates a Page class,
which is a handler
– Handlers must implement IHttpHandler
– Can configure alternate extensions to
map to a custom class that implements
IHttpHandler (httpHandlers section of
web.config)
– For handlers to be invoked, URI path
must be first mapped to the ASP.NET
ISAPI Dll (aspnet_isapi.dll) (IIS 6 and
earlier)
Custom Modules
• HttpModules can intercept any
Application-level events
– Exist at the application level (not per
request)
– Similar to ISAPI Filters
– Implement IHttpModule interface
– Initmethod called on application startup
allowing module to hook application-
level events
– System provided modules include
SessionStateModule,
UrlAuthorizationModule, and so on
System Provided Modules
Modules vs. global.asax
• Modules and custom applications
can perform many of the same
functions
– Not always obvious which to use
– Use global.asax for application-
specific functionality
– Use modules for 'pluggable' pieces of
functionality that may be used in
multiple applications
BUILDING APPLICATIONS WITH
ASP.NET MVC 4
Skillwise - Advanced web application development
Skillwise - Advanced web application development
ASP.NET MVC Design Goals
• Embrace the web
• Run on ASP.net
• Extensible
• Testable
Controllers
Routes & Controllers
routes.MapRoute(
"Default", //
Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home",
action = "Index",
id = ""
}
// Parameter defaults
Controller Execution
• IController
– Execute method invoked by MvcHandler
– Writes to the response stream
• ControllerBase
– Introduces ViewData and ControllerContext
• Controller
– Default base class in MVC
– Introduces Actions
– Includes helper methods for rendering content
Actions
• Actions are the
ultimate request
destination
– Public controller
methods
– Non-static
– No return value
restrictions
Action Parameters
• Actions can take a variety of
parameters
– Primitive parameters (int, bool, string)
– Complex parameters
• Model Binder looks for parameter
values
– In route data
– In form data
– In query string
Results
• Actions typically return an
• ActionResult
Action Selectors
• ActionName
• AcceptVerbs
– HttpPost, HttpGet
Action Filters
Custom Action Filters
• Derive from ActionFilterAttribute
base class
Views
Razor Templates
Template + Data = Generated
Output
Layout with Razor
• Use inherited methods to specify
content areas
– RenderBody
– RenderSection
HTML Helpers
• Html is a property of the ViewPage
base class
– Create inputs
– Create links
– Create forms
Custom Helpers
• Write extension methods for the
HtmlHelper class
– Return string or override ToString
method
– TagBuilder manages closing
tags and attributes
– Add namespace in
web.config
• The place for complicated view logic
Partials
• Partial views render portions of a
page
– Reuse pieces of a view
– Html helpers – Partial and Action
• Razor partial views are still .cshtml
files
Html.Action vs. Html.Partial
• Partial
– Use partials to reuse markup
• Action
– Think "sub-request"
– Let controller build sub-model, select partial
view
@Html.RenderPartial("movieDetail",
Model.Movie)
@Html.RenderAction("show",
"weather", new { postalCode="21740" }
Security
• Encoding
– Helps to avoid XSS attacks
– Not encoding user input makes you
particularly vulnerable
• Html.AntiForgeryToken
– Helps to avoids CSRF attacks
– Requires a ValidateAntiForgeryToken
attribute on controller action
– Valid only for POST operators
Skillwise - Advanced web application development
ADO.NET Entity Framework
• Access a relational data base with
strongly-typed LINQ queries
LINQ
• Comprehension Query Syntax
• Extension Method Syntax
SECURITY & ASP.NET MVC
Authentication
Forms Authentication
1. User tries to access “members only” page.
2. ASP.NET redirects user to login page
(“~/Account/Login”)
3. User submits username and password
4. ASP.NET sets authentication cookie,
redirects back to “members only” page.
Forms Authentication
• AccountController / Views
• WebMatrix WebSecurity
• SimpleMembershipProvider
• SQL Storage
Threat: Cross-Site Scripting
• Cookie Theft
• Download Malware
• XSS
• Account Hijacking
• Modify User Settings
• Modify Content
Skillwise - Advanced web application development

More Related Content

PPTX
Rails Request & Middlewares
PDF
Rails request & middlewares
PPTX
Spring Projects Infrastructure
PDF
Ajug - The Spring Update
PPTX
Introduction to laravel framework
PDF
Request-Response Cycle of Ruby on Rails App
PDF
Introduction to Rails by Evgeniy Hinyuk
PDF
Lecture #5 Introduction to rails
Rails Request & Middlewares
Rails request & middlewares
Spring Projects Infrastructure
Ajug - The Spring Update
Introduction to laravel framework
Request-Response Cycle of Ruby on Rails App
Introduction to Rails by Evgeniy Hinyuk
Lecture #5 Introduction to rails

What's hot (20)

PDF
FITC - Exploring Art-Directed Responsive Images
PPTX
Web : Request-Response Lifecycle (Ruby on Rails)
PPTX
AngularJS 1.x - your first application (problems and solutions)
PPTX
Eloquent workflow: delivering data from database to client in a right way
PPT
Jasig rubyon rails
PDF
(ATS6-PLAT09) Deploying Applications on load balanced AEP servers for high av...
PDF
React.js for Rails Developers
PPTX
Powershell For Developers
PPTX
Ei cakephp
PPTX
Cakeph pppt
PDF
React on rails v6.1 at LA Ruby, November 2016
PPTX
Agile sites2
PPTX
Introduction to ASP.Net MVC
PPTX
Agile sites @ telmore
PPTX
Salesforce winter 16 release
PPT
PPTX
Flux architecture
PPTX
Asp.Net Mvc
PPTX
04 integrate entityframework
FITC - Exploring Art-Directed Responsive Images
Web : Request-Response Lifecycle (Ruby on Rails)
AngularJS 1.x - your first application (problems and solutions)
Eloquent workflow: delivering data from database to client in a right way
Jasig rubyon rails
(ATS6-PLAT09) Deploying Applications on load balanced AEP servers for high av...
React.js for Rails Developers
Powershell For Developers
Ei cakephp
Cakeph pppt
React on rails v6.1 at LA Ruby, November 2016
Agile sites2
Introduction to ASP.Net MVC
Agile sites @ telmore
Salesforce winter 16 release
Flux architecture
Asp.Net Mvc
04 integrate entityframework

Viewers also liked (9)

PPTX
Los mapas conceptuales
PDF
La palabra
PPTX
Diseño De Funciones
PPTX
Harish Understanding Aspnet
PDF
Mapa conceptual
PPTX
Asp.net and .Net Framework ppt presentation
PPTX
Ch 04 asp.net application
PPTX
Directives in asp.net
PPSX
ASP.NET Web form
Los mapas conceptuales
La palabra
Diseño De Funciones
Harish Understanding Aspnet
Mapa conceptual
Asp.net and .Net Framework ppt presentation
Ch 04 asp.net application
Directives in asp.net
ASP.NET Web form

Similar to Skillwise - Advanced web application development (20)

PPTX
ASP.NET lecture 8
PPTX
Understanding ASP.NET Under The Cover - Miguel A. Castro
PPTX
Http pipeline
PPTX
Http pipeline
PPTX
PPTX
ASP.NET Presentation
PPTX
Aspnet architecture
PPTX
ASP.NET - Building Web Application..in the right way!
PPTX
ASP.NET - Building Web Application..in the right way!
PPTX
Asp.net With mvc handson
PPTX
ASP.NET Lecture 1
PDF
Asp .net web form fundamentals
PDF
ASP.NET MVC 2.0
PDF
Asp.netrole
PPTX
Asp.net
PPTX
CodeCamp Iasi 10 March 2012 - Gabriel Enea - ASP.NET Web API
PPTX
Programming web application
PPT
Asp.net server controls
PPT
ASP_NET_Architecture_Interfgfgfgnals1.ppt
ASP.NET lecture 8
Understanding ASP.NET Under The Cover - Miguel A. Castro
Http pipeline
Http pipeline
ASP.NET Presentation
Aspnet architecture
ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!
Asp.net With mvc handson
ASP.NET Lecture 1
Asp .net web form fundamentals
ASP.NET MVC 2.0
Asp.netrole
Asp.net
CodeCamp Iasi 10 March 2012 - Gabriel Enea - ASP.NET Web API
Programming web application
Asp.net server controls
ASP_NET_Architecture_Interfgfgfgnals1.ppt

More from Skillwise Group (20)

PPTX
Skillwise Consulting New updated
PPTX
Email Etiquette
PDF
Healthcare profile
PDF
Manufacturing courses
PDF
Retailing & logistics profile
PPTX
Skillwise orientation
PPTX
Overview- Skillwise Consulting
PPTX
Skillwise corporate presentation
PDF
Skillwise Profile
PDF
Skillwise Softskill Training Workshop
PDF
Skillwise Insurance profile
PDF
Skillwise Train and Hire Services
PDF
Skillwise Digital Technology
PDF
Skillwise Boot Camp Training
PDF
Skillwise Academy Profile
PPTX
Skillwise Overview
PPTX
SKILLWISE - OOPS CONCEPT
PPTX
Skillwise - Business writing
PPTX
PPTX
Skillwise cics part 1
Skillwise Consulting New updated
Email Etiquette
Healthcare profile
Manufacturing courses
Retailing & logistics profile
Skillwise orientation
Overview- Skillwise Consulting
Skillwise corporate presentation
Skillwise Profile
Skillwise Softskill Training Workshop
Skillwise Insurance profile
Skillwise Train and Hire Services
Skillwise Digital Technology
Skillwise Boot Camp Training
Skillwise Academy Profile
Skillwise Overview
SKILLWISE - OOPS CONCEPT
Skillwise - Business writing
Skillwise cics part 1

Recently uploaded (20)

PDF
Advancing precision in air quality forecasting through machine learning integ...
PDF
Launch a Bumble-Style App with AI Features in 2025.pdf
PDF
A symptom-driven medical diagnosis support model based on machine learning te...
PDF
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
PDF
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
PDF
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
PDF
SaaS reusability assessment using machine learning techniques
PDF
ment.tech-Siri Delay Opens AI Startup Opportunity in 2025.pdf
PDF
Data Virtualization in Action: Scaling APIs and Apps with FME
PDF
Early detection and classification of bone marrow changes in lumbar vertebrae...
PDF
A hybrid framework for wild animal classification using fine-tuned DenseNet12...
PDF
Human Computer Interaction Miterm Lesson
PPTX
Presentation - Principles of Instructional Design.pptx
PDF
Lung cancer patients survival prediction using outlier detection and optimize...
PPTX
How to Convert Tickets Into Sales Opportunity in Odoo 18
PPTX
Build automations faster and more reliably with UiPath ScreenPlay
PPTX
Blending method and technology for hydrogen.pptx
PDF
Co-training pseudo-labeling for text classification with support vector machi...
PDF
substrate PowerPoint Presentation basic one
PDF
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
Advancing precision in air quality forecasting through machine learning integ...
Launch a Bumble-Style App with AI Features in 2025.pdf
A symptom-driven medical diagnosis support model based on machine learning te...
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
SaaS reusability assessment using machine learning techniques
ment.tech-Siri Delay Opens AI Startup Opportunity in 2025.pdf
Data Virtualization in Action: Scaling APIs and Apps with FME
Early detection and classification of bone marrow changes in lumbar vertebrae...
A hybrid framework for wild animal classification using fine-tuned DenseNet12...
Human Computer Interaction Miterm Lesson
Presentation - Principles of Instructional Design.pptx
Lung cancer patients survival prediction using outlier detection and optimize...
How to Convert Tickets Into Sales Opportunity in Odoo 18
Build automations faster and more reliably with UiPath ScreenPlay
Blending method and technology for hydrogen.pptx
Co-training pseudo-labeling for text classification with support vector machi...
substrate PowerPoint Presentation basic one
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf

Skillwise - Advanced web application development

  • 3. Life of an ASP.NET Request • ASP.NET is layered on top of IIS5, IIS6 – IIS receives a request for a ASP.NET page – aspnet_isapi.dll registered for ASP.NET extensions – ISAPI extension passes request to worker process aspnet_wp.exe (IIS 5) or hands request to ASP.NET within w3wp.exe – ASP.NET classes take over request – When processing is complete, response is returned to IIS and ultimately back to client • ASP.NET is integrated into IIS7 – IIS receives a request for an ASP.NET page (.aspx) – Request is dispatched to PageHandlerFactory by IIS (handler associated with .aspx)
  • 7. Inside the Pipeline • Once inside the worker process, a request goes through a series of steps – It is first routed to the AppDomain associated with that application – A number of classes within the AppDomain interact to service the request • HttpRuntime • HttpWorkerRequest • HttpApplication • HttpContext • Modules • Handlers • ...
  • 8. Classes in the HTTP Pipeline of ASP.NET
  • 9. HttpContext • ASP.NET request information stored in HttpContext – Unique instance created for each request – Stores all request-specific data – Stores links to all relevant classes (Application, Session, ...) – Passed as a parameter to many methods (ProcessRequest)
  • 12. Applications • The first point of extensibility in the pipeline is the application – The application class acts as initial entry point for a request – Serves as a repository of globally available resources • application state • cache • session state • Gives access to many important events that occur during the lifetime of the application • Always an instance or derivative of HttpApplication • Accessible through HttpContext and Page classes
  • 14. Customizing the Application Class • You create a custom application by writing a global.asax file – Placed at the top-level of the virtual directory – Parsed and compiled into an assembly on first access – Creates a new class deriving from HttpApplication – Used in place of the default application class
  • 17. Additional events available through global.asax
  • 18. Custom Handlers • Each .aspx file creates a Page class, which is a handler – Handlers must implement IHttpHandler – Can configure alternate extensions to map to a custom class that implements IHttpHandler (httpHandlers section of web.config) – For handlers to be invoked, URI path must be first mapped to the ASP.NET ISAPI Dll (aspnet_isapi.dll) (IIS 6 and earlier)
  • 19. Custom Modules • HttpModules can intercept any Application-level events – Exist at the application level (not per request) – Similar to ISAPI Filters – Implement IHttpModule interface – Initmethod called on application startup allowing module to hook application- level events – System provided modules include SessionStateModule, UrlAuthorizationModule, and so on
  • 21. Modules vs. global.asax • Modules and custom applications can perform many of the same functions – Not always obvious which to use – Use global.asax for application- specific functionality – Use modules for 'pluggable' pieces of functionality that may be used in multiple applications
  • 25. ASP.NET MVC Design Goals • Embrace the web • Run on ASP.net • Extensible • Testable
  • 27. Routes & Controllers routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults
  • 28. Controller Execution • IController – Execute method invoked by MvcHandler – Writes to the response stream • ControllerBase – Introduces ViewData and ControllerContext • Controller – Default base class in MVC – Introduces Actions – Includes helper methods for rendering content
  • 29. Actions • Actions are the ultimate request destination – Public controller methods – Non-static – No return value restrictions
  • 30. Action Parameters • Actions can take a variety of parameters – Primitive parameters (int, bool, string) – Complex parameters • Model Binder looks for parameter values – In route data – In form data – In query string
  • 31. Results • Actions typically return an • ActionResult
  • 32. Action Selectors • ActionName • AcceptVerbs – HttpPost, HttpGet
  • 34. Custom Action Filters • Derive from ActionFilterAttribute base class
  • 35. Views
  • 36. Razor Templates Template + Data = Generated Output
  • 37. Layout with Razor • Use inherited methods to specify content areas – RenderBody – RenderSection
  • 38. HTML Helpers • Html is a property of the ViewPage base class – Create inputs – Create links – Create forms
  • 39. Custom Helpers • Write extension methods for the HtmlHelper class – Return string or override ToString method – TagBuilder manages closing tags and attributes – Add namespace in web.config • The place for complicated view logic
  • 40. Partials • Partial views render portions of a page – Reuse pieces of a view – Html helpers – Partial and Action • Razor partial views are still .cshtml files
  • 41. Html.Action vs. Html.Partial • Partial – Use partials to reuse markup • Action – Think "sub-request" – Let controller build sub-model, select partial view @Html.RenderPartial("movieDetail", Model.Movie) @Html.RenderAction("show", "weather", new { postalCode="21740" }
  • 42. Security • Encoding – Helps to avoid XSS attacks – Not encoding user input makes you particularly vulnerable • Html.AntiForgeryToken – Helps to avoids CSRF attacks – Requires a ValidateAntiForgeryToken attribute on controller action – Valid only for POST operators
  • 44. ADO.NET Entity Framework • Access a relational data base with strongly-typed LINQ queries
  • 45. LINQ • Comprehension Query Syntax • Extension Method Syntax
  • 48. Forms Authentication 1. User tries to access “members only” page. 2. ASP.NET redirects user to login page (“~/Account/Login”) 3. User submits username and password 4. ASP.NET sets authentication cookie, redirects back to “members only” page.
  • 49. Forms Authentication • AccountController / Views • WebMatrix WebSecurity • SimpleMembershipProvider • SQL Storage
  • 50. Threat: Cross-Site Scripting • Cookie Theft • Download Malware • XSS • Account Hijacking • Modify User Settings • Modify Content