SlideShare a Scribd company logo
1 of 34
ASP.NET MVC  One Step Deeper
Who I am Emad Alashi Technical Team Leader in eSense software http://www.EmadAshi.com http://www.DotNetArabi.com @EmadAshi
DotNetArabi دوت نت عربي
ASP.NET MVC  One Step Deeper
ASP.NET MVC One Step Deeper ,[object Object]
Dependency Injection
Action Filters
Razor
HTML Forms,[object Object]
ASP.NET MVC
ASP.NET MVC
Dependency Injection ASP.NET MVC One Step Deeper
Dependency Injection AccountingCalculations IoC Container JOTaxCalculator ITaxCalculator ,[object Object]
Windsor
Ninject
Unity,[object Object]
IDependencyResolver
GetService
GetServices
DependencyResolver.SetResolver(Object),[object Object],[object Object],[object Object],[object Object],[object Object]
Filters ,[object Object]
Authorization (IAuthorizationFilter)
Action (IActionFilter)
Result (IResultFilter)
Exception (IExceptionFilter)
ActionFilterAttribute: IActionFilter, IResultFilter
Examples of Filters:
Authorize
OutputCache
ChildActionOnly
HandleError
RequireHttps
ValidateAntiForgeryToken,[object Object]
Filters Filters

More Related Content

What's hot

Colin Bowern - The Not So Scary Side Of Asp.Net – Model View Controller In Th...
Colin Bowern - The Not So Scary Side Of Asp.Net – Model View Controller In Th...Colin Bowern - The Not So Scary Side Of Asp.Net – Model View Controller In Th...
Colin Bowern - The Not So Scary Side Of Asp.Net – Model View Controller In Th...
Refresh Events
 

What's hot (20)

Exception mapping using api kit
Exception mapping using api kitException mapping using api kit
Exception mapping using api kit
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular js
 
Angular JS, steal the idea
Angular JS, steal the ideaAngular JS, steal the idea
Angular JS, steal the idea
 
Colin Bowern - The Not So Scary Side Of Asp.Net – Model View Controller In Th...
Colin Bowern - The Not So Scary Side Of Asp.Net – Model View Controller In Th...Colin Bowern - The Not So Scary Side Of Asp.Net – Model View Controller In Th...
Colin Bowern - The Not So Scary Side Of Asp.Net – Model View Controller In Th...
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
Angular JS training institute in Jaipur
           Angular JS training institute in Jaipur           Angular JS training institute in Jaipur
Angular JS training institute in Jaipur
 
Method and decorator
Method and decoratorMethod and decorator
Method and decorator
 
Angular JS tutorial
Angular JS tutorialAngular JS tutorial
Angular JS tutorial
 
Introduction To Angular 4 - J2I
Introduction To Angular 4 - J2IIntroduction To Angular 4 - J2I
Introduction To Angular 4 - J2I
 
Single page application 03
Single page application   03Single page application   03
Single page application 03
 
Angular js for beginners
Angular js for beginnersAngular js for beginners
Angular js for beginners
 
Interfaces Not Required — RubyHACK 2018
Interfaces Not Required — RubyHACK 2018Interfaces Not Required — RubyHACK 2018
Interfaces Not Required — RubyHACK 2018
 
Dot net interview questions and asnwers
Dot net interview questions and asnwersDot net interview questions and asnwers
Dot net interview questions and asnwers
 
AngularJS
AngularJSAngularJS
AngularJS
 
Angular introduction basic
Angular introduction basicAngular introduction basic
Angular introduction basic
 
Introduction to AngularJS Framework
Introduction to AngularJS FrameworkIntroduction to AngularJS Framework
Introduction to AngularJS Framework
 
AngularJS 1.x training
AngularJS 1.x trainingAngularJS 1.x training
AngularJS 1.x training
 
Simple setup for an Angular EventEmitter
Simple setup for an Angular EventEmitterSimple setup for an Angular EventEmitter
Simple setup for an Angular EventEmitter
 
Angular js
Angular jsAngular js
Angular js
 
Angular JS: A Brief Introduction
Angular JS:  A Brief IntroductionAngular JS:  A Brief Introduction
Angular JS: A Brief Introduction
 

Viewers also liked

SoCal Code Camp 2011 - ASP.NET MVC 4
SoCal Code Camp 2011 - ASP.NET MVC 4SoCal Code Camp 2011 - ASP.NET MVC 4
SoCal Code Camp 2011 - ASP.NET MVC 4
Jon Galloway
 
Asp.net templated razor delegates
Asp.net templated razor delegatesAsp.net templated razor delegates
Asp.net templated razor delegates
LearningTech
 
DDD Sydney 20111 Razor Session
DDD Sydney 20111 Razor SessionDDD Sydney 20111 Razor Session
DDD Sydney 20111 Razor Session
Mohamed Meligy
 
Getting Started with ASP.NET MVC 3 and Razor
Getting Started with ASP.NET MVC 3 and RazorGetting Started with ASP.NET MVC 3 and Razor
Getting Started with ASP.NET MVC 3 and Razor
Dan Wahlin
 

Viewers also liked (14)

SoCal Code Camp 2011 - ASP.NET MVC 4
SoCal Code Camp 2011 - ASP.NET MVC 4SoCal Code Camp 2011 - ASP.NET MVC 4
SoCal Code Camp 2011 - ASP.NET MVC 4
 
Simple mvc4 prepared by gigin krishnan
Simple mvc4 prepared by gigin krishnanSimple mvc4 prepared by gigin krishnan
Simple mvc4 prepared by gigin krishnan
 
Asp.net templated razor delegates
Asp.net templated razor delegatesAsp.net templated razor delegates
Asp.net templated razor delegates
 
Views
ViewsViews
Views
 
Template Layout Overrides - a beginner's guide
Template Layout Overrides - a beginner's guideTemplate Layout Overrides - a beginner's guide
Template Layout Overrides - a beginner's guide
 
DDD Sydney 20111 Razor Session
DDD Sydney 20111 Razor SessionDDD Sydney 20111 Razor Session
DDD Sydney 20111 Razor Session
 
Razor and the Art of Templating
Razor and the Art of TemplatingRazor and the Art of Templating
Razor and the Art of Templating
 
Hadoop-BigData
Hadoop-BigDataHadoop-BigData
Hadoop-BigData
 
ASP.NET MVC 3
ASP.NET MVC 3ASP.NET MVC 3
ASP.NET MVC 3
 
Net 451 in action
Net 451 in actionNet 451 in action
Net 451 in action
 
What’s New and Hot in .NET 4.0
What’s New and Hot in .NET 4.0What’s New and Hot in .NET 4.0
What’s New and Hot in .NET 4.0
 
Asp.Net MVC - Razor Syntax
Asp.Net MVC - Razor SyntaxAsp.Net MVC - Razor Syntax
Asp.Net MVC - Razor Syntax
 
Getting Started with ASP.NET MVC 3 and Razor
Getting Started with ASP.NET MVC 3 and RazorGetting Started with ASP.NET MVC 3 and Razor
Getting Started with ASP.NET MVC 3 and Razor
 
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
 

Similar to ASP.NET MVC One Step Deeper

SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
SoftServe
 
ASP.NET MVC as the next step in web development
ASP.NET MVC as the next step in web developmentASP.NET MVC as the next step in web development
ASP.NET MVC as the next step in web development
Volodymyr Voytyshyn
 
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
SharePoint Saturday NY
 

Similar to ASP.NET MVC One Step Deeper (20)

Asp.Net MVC Intro
Asp.Net MVC IntroAsp.Net MVC Intro
Asp.Net MVC Intro
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
 
Overview of CSharp MVC3 and EF4
Overview of CSharp MVC3 and EF4Overview of CSharp MVC3 and EF4
Overview of CSharp MVC3 and EF4
 
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
 
Jinal desai .net
Jinal desai .netJinal desai .net
Jinal desai .net
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
 
Overview of MVC Framework - by software outsourcing company india
Overview of MVC Framework - by software outsourcing company indiaOverview of MVC Framework - by software outsourcing company india
Overview of MVC Framework - by software outsourcing company india
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
 
MVC
MVCMVC
MVC
 
MVC From Beginner to Advance in Indian Style by - Indiandotnet
MVC From Beginner to Advance in Indian Style by - IndiandotnetMVC From Beginner to Advance in Indian Style by - Indiandotnet
MVC From Beginner to Advance in Indian Style by - Indiandotnet
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handson
 
ASP.NET MVC as the next step in web development
ASP.NET MVC as the next step in web developmentASP.NET MVC as the next step in web development
ASP.NET MVC as the next step in web development
 
MVC Training Part 2
MVC Training Part 2MVC Training Part 2
MVC Training Part 2
 
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
 
AspMVC4 start101
AspMVC4 start101AspMVC4 start101
AspMVC4 start101
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
 
Head first asp.net mvc 2.0 rtt
Head first asp.net mvc 2.0 rttHead first asp.net mvc 2.0 rtt
Head first asp.net mvc 2.0 rtt
 
Mike Taulty MIX10 Silverlight Frameworks and Patterns
Mike Taulty MIX10 Silverlight Frameworks and PatternsMike Taulty MIX10 Silverlight Frameworks and Patterns
Mike Taulty MIX10 Silverlight Frameworks and Patterns
 
struts
strutsstruts
struts
 
Intro to .NET for Government Developers
Intro to .NET for Government DevelopersIntro to .NET for Government Developers
Intro to .NET for Government Developers
 

More from Emad Alashi

More from Emad Alashi (12)

RBAC in Azure Kubernetes Service AKS
RBAC in Azure Kubernetes Service AKSRBAC in Azure Kubernetes Service AKS
RBAC in Azure Kubernetes Service AKS
 
Am I a Good Developer
Am I a Good DeveloperAm I a Good Developer
Am I a Good Developer
 
Basic Intro to WinDbg
Basic Intro to WinDbgBasic Intro to WinDbg
Basic Intro to WinDbg
 
Acquiring knowledge
Acquiring knowledgeAcquiring knowledge
Acquiring knowledge
 
Owin, Katana, and Helios
Owin, Katana, and HeliosOwin, Katana, and Helios
Owin, Katana, and Helios
 
OAuth in the new .NET world (OWIN)
OAuth in the new .NET world (OWIN)OAuth in the new .NET world (OWIN)
OAuth in the new .NET world (OWIN)
 
ASP.NET Routing & MVC
ASP.NET Routing & MVCASP.NET Routing & MVC
ASP.NET Routing & MVC
 
Software Life Cycle, Humans & Code
Software Life Cycle, Humans & CodeSoftware Life Cycle, Humans & Code
Software Life Cycle, Humans & Code
 
HTML5 & IE
HTML5 & IEHTML5 & IE
HTML5 & IE
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
 
Communication Skills one To one
Communication Skills one To oneCommunication Skills one To one
Communication Skills one To one
 
Introduction To NHibernate
Introduction To NHibernateIntroduction To NHibernate
Introduction To NHibernate
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 

ASP.NET MVC One Step Deeper

Editor's Notes

  1. Model is ignorantView knows about Model onlyController knows about both Model and View
  2. Image from Dino Esposito’s article
  3. Check the references to see where from this figure was used
  4. Service Locators will act as a layer over Dependency Injection containersYou have to implement IDependencyResolver in order to use the container you want and add any specific logic you might need, though it’s advised not to go too sophisticated thereNinject will implmentIDependencyResolver for youYou will call DependencyResolver.SetResolver to set the resolver Dah!Each part of MVC will use this Service Locator and in the way it sees fit; Controllers have DefaultControllerActivator that uses your new implementation of IDependencyResolver, View have DefaultViewPageActivator, …etc.
  5. Service Locators will act as a layer over Dependency Injection containersYou have to implement IDependencyResolver in order to use the container you want and add any specific logic you might need, though it’s advised not to go too sophisticated thereNinject will implmentIDependencyResolver for youEach part of MVC will use this Service Locator and in the way it sees fit; Controllers have DefaultControllerActivator that uses your new implementation of IDependencyResolver, View have DefaultViewPageActivator, …etc.
  6. Better Inherit from “ActionFilterAttribute” if you need to do attribute filterIf you want to do Authorization filter consider inheriting from “FilterAttribute” classFilters can decorate an Action, a Controller (ControllerInstance), and to be global Authorize: checks to see whether the current user is logged in, and matches a provided username or role name (or names), and if not it returns a 401 status, which in turn invokes the configured authentication providerChildActionOnly: used to indicate that the action method may only be called as part of a parent request, to render inline markup, rather then returning a full view template.OutputCache: tells ASP.NET to cache the output of the requested action, and to serve the cached output based on the parameters provided. HandleError: provides a mechanism for mapping exceptions to specific View templates, so that you can easily provide custom error pages to your users for specific exceptions (or simply have a generic error view template that handles all exceptions). RequireHttps: forces a switch from http to https by redirecting GET requests to the https version of the requested URL, and rejects non-https POST requestsValidateAntiForgeryToken: checks to see whether the server request has been tampered with. Used in conjunction with the AntiForgeryToken HTML Helper, which injects a hidden input field and cookie for later verification
  7. Filter Providers are filters of Filters by which you can manipulate filters before action
  8. You can inherit from a Provider (e.g. FilterAttributeFilterProvider) and override GetFilters().AsEnumerabe<Filter>() something I learned by reading blogs and trying code out. I can’t recall when or how, but this shows how important reading blogs and trying code out is, I would have had hard time figuring how to return an IEnumerable the way I wanted
  9. Razor knows where to break
  10. PageData to pass data to the Layout page@functions you can declare code thereUse @Url.Content for proper path
  11. Html Helpers are Extension methods that will make it easy to render html code for different uses (displaying links, fields, etc…)
  12. A SelectList instance can be used to populate the list with the default value
  13. UIHint is an attribute used to decorate a property in the Model class, will specify the name of the control to be used to display/edit the property