SlideShare a Scribd company logo
Introduction To ASP.NET MVC 4
Nitin Sawant
.NET developer
Webforms Pros
• Rich Controls (grids, etc…)
• RAD
• Event Driven (like Winforms)
• Stateful
• Less Control
• No built-in Separation of Concerns (SoC)
• Complicated Page life-cycle
• Not SEO friendly
 URL
 Big Viewstate at the beginning of the page
Webforms Cons
MVC Pattern
• What is MVC?
• Why MVC?
• Who uses MVC?
…“the concept of the design pattern in
software provides a key to helping developers
leverage the expertise of other skilled
architects.”
Grady Booch, 1995
 MVC - Acronym for Model-View-Controller
 MVC is a architectural pattern
 Invented by Trygve Reenskaug in 1978
 Originally used as an architectural pattern for building GUIs.
MVC Pattern
What is it?
Why MVC?
ASP.NET MVC Pros
 More control over your html and JavaScript
 Separation of Concerns (SoC)
 SEO friendly
 Test Driven Development (TDD)
 Highly flexible & customizable
 Not RAD
 No rich controls
ASP.NET MVC Cons
MVC Pattern
Who uses it?
• .NET has Spring.NET and MonoRail
• Java has Swing, Struts, Grails and others
• Perl has Catalyst, Gantry, Jifty and others
• PHP has Zend, Zoop, Agavi and others
• Python has Django, Gluon, Pylon and others
• Ruby has Ruby on Rails
• Apple has cocoa and cocoa touch for objective-c [Mac, iPhone]
ASP.Net MVC Overview
• ASP.NET MVC?
• ASP.Net MVC Execution Process
• ASP.Net MVC 4 Project Structure
ASP.Net MVC Overview
ASP.Net MVC Architecture
M
Model
V
View
C
Controller
• Representation of domain data
• Business Logic
• Persistence mechanisms
• User Interface
• The representation of Model
• An intermediary between Model and View
• Application’s Brain (Handle user requests, bind
Data, return views)
ASP.NET
Dynamic Data
ASP.NET
WebForms
ASP.NET
MVC
Presentation
Runtime
ASP.NET
Core
It’s not a replacement for asp.net webforms, it’s a new flavour of asp.net
ASP.Net MVC Overview
ASP.Net MVC?
ASP.Net MVC Overview
ASP.Net MVC Execution Process
ASP.NET MVC 4 Project
Structure
1. App_Data folder is the physical store for data.
2. Content folder keeps files such as scripts, CSS, images, etc
3. Controllers folder is the location for controllers.
4. Models stores classes that handle application domain logic.
5. Scripts folder is for script files. By default, this folder
contains AJAX script files and the JQuery library.
6. Views is the recommended location for views. View files
use .cshtml extension.
Routing R => the hidden characterMVC +R
1. Maps incoming URLs to the application and routes them to the right
Controller’s Action method to execute them
2. Happens in RegisterRoutes function in the global.asax file
Routing
Don’t settle for…
/ProductsDetails.aspx?CategoryID=123
When you can easily have…
/Product/Details/123/
Or whatever else makes sense…
Routing
To customize routing rules
Model [M]
Model
• It’s the core of your application
• A place for business logic, data access, Validation ... etc
• You can use your favorite data access technology with
ASP.NET MVC [LINQ to SQL, Nhibernate, Entity Framework
…etc]
Controller [C]
Controls the flow of application execution
 Controller is a class containing a set of action methods.
 Responsible for
o Handling user interaction
o Working with the models
o Selecting a view to render
o Sending model and information to a particular view
o Making decisions for security, UI, redirects ... etc.
 The ASP.Net MVC requires the names of all controllers to end with the
suffix "Controller“ e.g. HomeController, LoginController & ProductController
Controller
Actions Rules:
1) Must be a public method
2) Cannot be a static method
3) Cannot be an extension method
4) Cannot be a constructor or property
5) Cannot have generic type.
6) Cannot contain ref or out parameters.
Controller
Controller Actions
An action is a method on a controller that gets called when you enter a
particular URL in your browser address bar.
Each action returns ActionResult which can be
• ViewResult => HTML and markup.
• EmptyResult => no result.
• RedirectResult => redirection to a new URL.
• JsonResult => json result that can be used in an AJAX application.
• JavaScriptResult => JavaScript script.
• ContentResult => text result [and wraps any non ActionResult return Type].
• FileContentResult => downloadable file [with the binary content].
• FilePathResult => downloadable file [with a path].
• FileStreamResult => a downloadable file [with a file stream].
A controller action always returns an ActionResult
Controller
Controller Actions
Note: all public methods of a controller class considered as action methods, if
you don’t want a public method to be an action, mark it with [NonAction()]
attribute
View [V]
View
• Responsible for presentation, look & feel, formatting, sorting … etc.
• Interacts with model but doesn’t make any decisions
• No logic should go there
• No View State, No Server Controls
• HTML Helper functions
• Can be strongly typed
• Takes the view data from the controller
Tips:
• @ is equivalent to response.write()
• @{} is used to execute code
• Use @Html.Encode() method to prevent script injection
View Engines
ASPX
Razor
View Engines
ASPX
Razor
• Html.ActionLink()
• Html.BeginForm()
• Html.CheckBox()
• Html.DropDownList()
• Html.EndForm()
• Html.Hidden()
An HTML Helper is just a method that returns a string.
View
HTML Helpers
• Html.ListBox()
• Html.Password()
• Html.RadioButton()
• Html.TextArea()
• Html.TextBox()
e.g.
References
•Official website http://asp.net/mvc
•Source Code http://codeplex.com/aspnet
•Blogs
o Scott Guthrie http://weblogs.asp.net/scottgu
o Rob Conrey http://blog.wekeroad.com
o MVC Store Front http://blog.wekeroad.com/mvc-storefront
o Phil Haack http://haacked.com
o Scott Hanselman http://hanselman.com
o Stephen Walthler http://weblogs.asp.net/stephenwalther
Nitin Sawant
Software Engineer
Email:nitin@nitinsawant.com
T h a n k y o u
www.twitter.com/nitinjs
www.linkedin.com/in/nitinjs
Ad

More Related Content

What's hot (20)

Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
Naga Harish M
 
ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines  ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines
Dev Raj Gautam
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentation
Bhavin Shah
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
Volkan Uzun
 
MVC 6 Introduction
MVC 6 IntroductionMVC 6 Introduction
MVC 6 Introduction
Sudhakar Sharma
 
MVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros DeveloperMVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros Developer
Nyros Technologies
 
Asp.net mvc basic introduction
Asp.net mvc basic introductionAsp.net mvc basic introduction
Asp.net mvc basic introduction
Bhagath Gopinath
 
Mvc summary
Mvc summaryMvc summary
Mvc summary
Muhammad Younis
 
Asp.net mvc 5 course module 1 overview
Asp.net mvc 5 course   module 1 overviewAsp.net mvc 5 course   module 1 overview
Asp.net mvc 5 course module 1 overview
Sergey Seletsky
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
Thomas Robbins
 
Introduction to mvc architecture
Introduction to mvc architectureIntroduction to mvc architecture
Introduction to mvc architecture
ravindraquicsolv
 
ASP.NET MVC for Begineers
ASP.NET MVC for BegineersASP.NET MVC for Begineers
ASP.NET MVC for Begineers
Shravan Kumar Kasagoni
 
CTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCCTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVC
Barry Gervin
 
ASP .Net MVC 5
ASP .Net MVC 5ASP .Net MVC 5
ASP .Net MVC 5
Nilachal sethi
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
Khaled Musaied
 
Mvc architecture
Mvc architectureMvc architecture
Mvc architecture
Surbhi Panhalkar
 
Asp 1a-aspnetmvc
Asp 1a-aspnetmvcAsp 1a-aspnetmvc
Asp 1a-aspnetmvc
Fajar Baskoro
 
Mvc
MvcMvc
Mvc
abhigad
 
ASP.NET MVC.
ASP.NET MVC.ASP.NET MVC.
ASP.NET MVC.
Ni
 
Dot net interview questions and asnwers
Dot net interview questions and asnwersDot net interview questions and asnwers
Dot net interview questions and asnwers
kavinilavuG
 
ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines  ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines
Dev Raj Gautam
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentation
Bhavin Shah
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
Volkan Uzun
 
MVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros DeveloperMVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros Developer
Nyros Technologies
 
Asp.net mvc basic introduction
Asp.net mvc basic introductionAsp.net mvc basic introduction
Asp.net mvc basic introduction
Bhagath Gopinath
 
Asp.net mvc 5 course module 1 overview
Asp.net mvc 5 course   module 1 overviewAsp.net mvc 5 course   module 1 overview
Asp.net mvc 5 course module 1 overview
Sergey Seletsky
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
Thomas Robbins
 
Introduction to mvc architecture
Introduction to mvc architectureIntroduction to mvc architecture
Introduction to mvc architecture
ravindraquicsolv
 
CTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCCTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVC
Barry Gervin
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
Khaled Musaied
 
ASP.NET MVC.
ASP.NET MVC.ASP.NET MVC.
ASP.NET MVC.
Ni
 
Dot net interview questions and asnwers
Dot net interview questions and asnwersDot net interview questions and asnwers
Dot net interview questions and asnwers
kavinilavuG
 

Similar to Asp.net mvc presentation by Nitin Sawant (20)

Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handson
Prashant Kumar
 
Asp 1-mvc introduction
Asp 1-mvc introductionAsp 1-mvc introduction
Asp 1-mvc introduction
Fajar Baskoro
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8
Thomas Robbins
 
Aspnetmvc 1
Aspnetmvc 1Aspnetmvc 1
Aspnetmvc 1
Fajar Baskoro
 
Mvc
MvcMvc
Mvc
Furqan Ashraf
 
2011 NetUG HH: ASP.NET MVC & HTML 5
2011 NetUG HH: ASP.NET MVC & HTML 52011 NetUG HH: ASP.NET MVC & HTML 5
2011 NetUG HH: ASP.NET MVC & HTML 5
Daniel Fisher
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
Taranjeet Singh
 
Asp.Net MVC 5 in Arabic
Asp.Net MVC 5 in ArabicAsp.Net MVC 5 in Arabic
Asp.Net MVC 5 in Arabic
Haitham Shaddad
 
MVC & SQL_In_1_Hour
MVC & SQL_In_1_HourMVC & SQL_In_1_Hour
MVC & SQL_In_1_Hour
Dilip Patel
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
Rasel Khan
 
CG_CS25010_Lecture
CG_CS25010_LectureCG_CS25010_Lecture
CG_CS25010_Lecture
Connor Goddard
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Rails
codeinmotion
 
Introduction to ASP.Net MVC
Introduction to ASP.Net MVCIntroduction to ASP.Net MVC
Introduction to ASP.Net MVC
Sagar Kamate
 
Intro to .NET for Government Developers
Intro to .NET for Government DevelopersIntro to .NET for Government Developers
Intro to .NET for Government Developers
Frank La Vigne
 
Session 1
Session 1Session 1
Session 1
Asif Atick
 
ASP.NET MVC Best Practices malisa ncube
ASP.NET MVC Best Practices   malisa ncubeASP.NET MVC Best Practices   malisa ncube
ASP.NET MVC Best Practices malisa ncube
Malisa Ncube
 
MVC Framework
MVC FrameworkMVC Framework
MVC Framework
Ashton Feller
 
Mvc fundamental
Mvc fundamentalMvc fundamental
Mvc fundamental
Nguyễn Thành Phát
 
MVC 4
MVC 4MVC 4
MVC 4
Vasilios Kuznos
 
Hanselman lipton asp_connections_ams304_mvc
Hanselman lipton asp_connections_ams304_mvcHanselman lipton asp_connections_ams304_mvc
Hanselman lipton asp_connections_ams304_mvc
denemedeniz
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handson
Prashant Kumar
 
Asp 1-mvc introduction
Asp 1-mvc introductionAsp 1-mvc introduction
Asp 1-mvc introduction
Fajar Baskoro
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8
Thomas Robbins
 
2011 NetUG HH: ASP.NET MVC & HTML 5
2011 NetUG HH: ASP.NET MVC & HTML 52011 NetUG HH: ASP.NET MVC & HTML 5
2011 NetUG HH: ASP.NET MVC & HTML 5
Daniel Fisher
 
MVC & SQL_In_1_Hour
MVC & SQL_In_1_HourMVC & SQL_In_1_Hour
MVC & SQL_In_1_Hour
Dilip Patel
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
Rasel Khan
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Rails
codeinmotion
 
Introduction to ASP.Net MVC
Introduction to ASP.Net MVCIntroduction to ASP.Net MVC
Introduction to ASP.Net MVC
Sagar Kamate
 
Intro to .NET for Government Developers
Intro to .NET for Government DevelopersIntro to .NET for Government Developers
Intro to .NET for Government Developers
Frank La Vigne
 
ASP.NET MVC Best Practices malisa ncube
ASP.NET MVC Best Practices   malisa ncubeASP.NET MVC Best Practices   malisa ncube
ASP.NET MVC Best Practices malisa ncube
Malisa Ncube
 
Hanselman lipton asp_connections_ams304_mvc
Hanselman lipton asp_connections_ams304_mvcHanselman lipton asp_connections_ams304_mvc
Hanselman lipton asp_connections_ams304_mvc
denemedeniz
 
Ad

Recently uploaded (20)

Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Adobe Photoshop Lightroom CC 2025 Crack Latest Version
Adobe Photoshop Lightroom CC 2025 Crack Latest VersionAdobe Photoshop Lightroom CC 2025 Crack Latest Version
Adobe Photoshop Lightroom CC 2025 Crack Latest Version
usmanhidray
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Mastering OOP: Understanding the Four Core Pillars
Mastering OOP: Understanding the Four Core PillarsMastering OOP: Understanding the Four Core Pillars
Mastering OOP: Understanding the Four Core Pillars
Marcel David
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
Sales Deck SentinelOne Singularity Platform.pptx
Sales Deck SentinelOne Singularity Platform.pptxSales Deck SentinelOne Singularity Platform.pptx
Sales Deck SentinelOne Singularity Platform.pptx
EliandoLawnote
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Adobe Photoshop CC 2025 Crack Full Serial Key With Latest
Adobe Photoshop CC 2025 Crack Full Serial Key  With LatestAdobe Photoshop CC 2025 Crack Full Serial Key  With Latest
Adobe Photoshop CC 2025 Crack Full Serial Key With Latest
usmanhidray
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Adobe Photoshop Lightroom CC 2025 Crack Latest Version
Adobe Photoshop Lightroom CC 2025 Crack Latest VersionAdobe Photoshop Lightroom CC 2025 Crack Latest Version
Adobe Photoshop Lightroom CC 2025 Crack Latest Version
usmanhidray
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Mastering OOP: Understanding the Four Core Pillars
Mastering OOP: Understanding the Four Core PillarsMastering OOP: Understanding the Four Core Pillars
Mastering OOP: Understanding the Four Core Pillars
Marcel David
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
Sales Deck SentinelOne Singularity Platform.pptx
Sales Deck SentinelOne Singularity Platform.pptxSales Deck SentinelOne Singularity Platform.pptx
Sales Deck SentinelOne Singularity Platform.pptx
EliandoLawnote
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Adobe Photoshop CC 2025 Crack Full Serial Key With Latest
Adobe Photoshop CC 2025 Crack Full Serial Key  With LatestAdobe Photoshop CC 2025 Crack Full Serial Key  With Latest
Adobe Photoshop CC 2025 Crack Full Serial Key With Latest
usmanhidray
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Ad

Asp.net mvc presentation by Nitin Sawant

  • 1. Introduction To ASP.NET MVC 4 Nitin Sawant .NET developer
  • 2. Webforms Pros • Rich Controls (grids, etc…) • RAD • Event Driven (like Winforms) • Stateful • Less Control • No built-in Separation of Concerns (SoC) • Complicated Page life-cycle • Not SEO friendly  URL  Big Viewstate at the beginning of the page Webforms Cons
  • 3. MVC Pattern • What is MVC? • Why MVC? • Who uses MVC? …“the concept of the design pattern in software provides a key to helping developers leverage the expertise of other skilled architects.” Grady Booch, 1995
  • 4.  MVC - Acronym for Model-View-Controller  MVC is a architectural pattern  Invented by Trygve Reenskaug in 1978  Originally used as an architectural pattern for building GUIs. MVC Pattern What is it?
  • 5. Why MVC? ASP.NET MVC Pros  More control over your html and JavaScript  Separation of Concerns (SoC)  SEO friendly  Test Driven Development (TDD)  Highly flexible & customizable  Not RAD  No rich controls ASP.NET MVC Cons
  • 6. MVC Pattern Who uses it? • .NET has Spring.NET and MonoRail • Java has Swing, Struts, Grails and others • Perl has Catalyst, Gantry, Jifty and others • PHP has Zend, Zoop, Agavi and others • Python has Django, Gluon, Pylon and others • Ruby has Ruby on Rails • Apple has cocoa and cocoa touch for objective-c [Mac, iPhone]
  • 7. ASP.Net MVC Overview • ASP.NET MVC? • ASP.Net MVC Execution Process • ASP.Net MVC 4 Project Structure
  • 8. ASP.Net MVC Overview ASP.Net MVC Architecture M Model V View C Controller • Representation of domain data • Business Logic • Persistence mechanisms • User Interface • The representation of Model • An intermediary between Model and View • Application’s Brain (Handle user requests, bind Data, return views)
  • 9. ASP.NET Dynamic Data ASP.NET WebForms ASP.NET MVC Presentation Runtime ASP.NET Core It’s not a replacement for asp.net webforms, it’s a new flavour of asp.net ASP.Net MVC Overview ASP.Net MVC?
  • 10. ASP.Net MVC Overview ASP.Net MVC Execution Process
  • 11. ASP.NET MVC 4 Project Structure 1. App_Data folder is the physical store for data. 2. Content folder keeps files such as scripts, CSS, images, etc 3. Controllers folder is the location for controllers. 4. Models stores classes that handle application domain logic. 5. Scripts folder is for script files. By default, this folder contains AJAX script files and the JQuery library. 6. Views is the recommended location for views. View files use .cshtml extension.
  • 12. Routing R => the hidden characterMVC +R 1. Maps incoming URLs to the application and routes them to the right Controller’s Action method to execute them 2. Happens in RegisterRoutes function in the global.asax file
  • 13. Routing Don’t settle for… /ProductsDetails.aspx?CategoryID=123 When you can easily have… /Product/Details/123/ Or whatever else makes sense…
  • 16. Model • It’s the core of your application • A place for business logic, data access, Validation ... etc • You can use your favorite data access technology with ASP.NET MVC [LINQ to SQL, Nhibernate, Entity Framework …etc]
  • 17. Controller [C] Controls the flow of application execution
  • 18.  Controller is a class containing a set of action methods.  Responsible for o Handling user interaction o Working with the models o Selecting a view to render o Sending model and information to a particular view o Making decisions for security, UI, redirects ... etc.  The ASP.Net MVC requires the names of all controllers to end with the suffix "Controller“ e.g. HomeController, LoginController & ProductController Controller
  • 19. Actions Rules: 1) Must be a public method 2) Cannot be a static method 3) Cannot be an extension method 4) Cannot be a constructor or property 5) Cannot have generic type. 6) Cannot contain ref or out parameters. Controller Controller Actions An action is a method on a controller that gets called when you enter a particular URL in your browser address bar.
  • 20. Each action returns ActionResult which can be • ViewResult => HTML and markup. • EmptyResult => no result. • RedirectResult => redirection to a new URL. • JsonResult => json result that can be used in an AJAX application. • JavaScriptResult => JavaScript script. • ContentResult => text result [and wraps any non ActionResult return Type]. • FileContentResult => downloadable file [with the binary content]. • FilePathResult => downloadable file [with a path]. • FileStreamResult => a downloadable file [with a file stream]. A controller action always returns an ActionResult Controller Controller Actions Note: all public methods of a controller class considered as action methods, if you don’t want a public method to be an action, mark it with [NonAction()] attribute
  • 22. View • Responsible for presentation, look & feel, formatting, sorting … etc. • Interacts with model but doesn’t make any decisions • No logic should go there • No View State, No Server Controls • HTML Helper functions • Can be strongly typed • Takes the view data from the controller Tips: • @ is equivalent to response.write() • @{} is used to execute code • Use @Html.Encode() method to prevent script injection
  • 25. • Html.ActionLink() • Html.BeginForm() • Html.CheckBox() • Html.DropDownList() • Html.EndForm() • Html.Hidden() An HTML Helper is just a method that returns a string. View HTML Helpers • Html.ListBox() • Html.Password() • Html.RadioButton() • Html.TextArea() • Html.TextBox() e.g.
  • 26. References •Official website http://asp.net/mvc •Source Code http://codeplex.com/aspnet •Blogs o Scott Guthrie http://weblogs.asp.net/scottgu o Rob Conrey http://blog.wekeroad.com o MVC Store Front http://blog.wekeroad.com/mvc-storefront o Phil Haack http://haacked.com o Scott Hanselman http://hanselman.com o Stephen Walthler http://weblogs.asp.net/stephenwalther
  • 27. Nitin Sawant Software Engineer Email:[email protected] T h a n k y o u www.twitter.com/nitinjs www.linkedin.com/in/nitinjs