SlideShare a Scribd company logo
MVC with Kentico 8
Thomas Robbins
Radek Pribyl
Introduction to MVC
Thomas Robbins
thomasr@Kentico.com
A history lesson..
ASP.NET Web Form
• A set of UI components
(pages, buttons etc.)
plus a stateful object
oriented GUI
programming model
ASP.NET
• A way to host .NET
application in IIS that let’s
you interact with HTTP
requests and responses
.NET
• A multi-language managed
code platform
The Strength of ASP.NET Web Forms
• Making web development feel the
same as Windows Form development
• No need to work with individual HTTP
requests and easier to think in terms
of a stateful UI
Some problems with ASP.NET Web Forms
View state weight – Mechanism for maintaining state (view state) results in large
blocks of data between client and server
Page life cycle – Connecting client side events with server side event handler code
is complicated and delicate
False sense of separation – ASP.NET web Forms code behind model provides a
means to take application code out of HTML markup. Unfortunately, this allows for
mix presentation models (manipulating a server side tree)
Limited control over HTML – Server side controls render themselves as HTML but
not always the HTML you want
Low testability – Nobody could have anticipated that automated testing would
become essential
Not all bad – ASP.NET Web Forms provide a quick
results and allows reasonably complex web
applications to be built quickly!
What matters most…
Code reusability
• Shortens development
• Code libraries
• Design patterns
• Frameworks
Separation of concerns
• Improves code clarity and organization
• Helps troubleshoot by isolating issues
• Allows for multiple teams to develop
simultaneously
What is MVC?
Model represents the data model
• “Manages behavior and data of the
application domain”
View represents the screen shown to
the user
• “Manages the graphical and/or textual
output to the portion of the bitmapped
display that is allocated to the application”
Controller represents interaction
from the user that changes the data
and the view
• “Interprets the mouse and keyboard
inputs from the user, commanding the
model and/or the view to changes as
appropriate”
MVC isn’t new!
Presented by Trygve Reenskaug
in 1979
First used in the Smalltalk-80
framework
• Used in making Apple interfaces
(Lisa and Macintosh)
MVC Step by Step
Getting started with MVC 5
The project structure
• App_Data is the physical store for data. This folder
has the same role as it does in ASP.NET web sites that
use Web Form pages
• Content is the recommended location to add static
content files like CSS and images
• Controllers is the recommended location for
controllers. All controllers must end with “Controller”
• Models is provided for classes that represent the
application model. This folder usually contains code
that defines objects and logic for application with the
data store
• Scripts is the recommended location for script files
that support the application. By default this folder
contains ASP.NET Ajax Foundation files and Jquery
• Views is the recommended location for views. These
are ViewPage (.aspx), ViewUserControl (.ascx) and
ViewMaster (.master) in additional to any other files
needed for renderings. The view folder also contains a
folder for each controller.
MVC
• Easier to Manage Complexity
• Does not use view state or server
based forms
• Rich Routing Structure
• Support for Test-Driven
Development
• Supports Large Teams Well
WebForms
• Preservers State over HTTP
• Page Controller Pattern
• View state or server based forms
• Works well for small teams
• Development is less complex
Everything has it’s advantages
MVC Routes
• A route is an object that parses a requested URL and it
determines the controller and action to which the request is
forwarded
• Routing operates on the directories and the file name of tin the
relative URL
Uses the format
/[Controller]/[ActionName]/[Parameters]
What’s the route
Matching a URL request to a route depends on all of the following conditions:
• The route patterns that you have defined or the default route patterns, if any, that are included
in your project type.
• The order in which you added them to the Routes collection.
• Any default values that you have provided for a route.
• Any constraints that you have provided for a route.
• Whether you have defined routing to handle requests that match a physical file.
MVC in Kentico 8
Radek Pribyl
(Technical leader - Portal engine, MVC)
Installation
Requirements
• .NET Framework 4.5/4.5.1
• Project type – Web application
Configuration
• None
MVC version
• MVC4 included in the Kentico 8 installation
Architecture
Kentico as a content platform
• Data stored in documents and custom tables
MVC renders live site
• Controller, Views – custom implementation
• Manual routing management recommended
MVC handler
Request
Live site
(MVC)
ASPX handler
CMS Core
Kentico Admin
(Web forms)
HTML…
Web application sructure
CMSApp
• Standard Kentico web application project (Web forms)
CMSApp_AppCode
• Contains all the files which you would place into the ASP.NET folder
Old_App_Code (or App_Code in Web site project)
CMSApp_MVC
• MVC4 web application project
• Standard Kentico module – registered in the Kentico application =>
uses API handlers
• Simplifies development
• All the MVC related files belong here
• NewsController + Views examples – used in the Corporate sample site
CMSApp_MVC project
App_Start
• Standard MVC project folder
• RouteConfig.cs
• FilterConfig.cs
CMS_MvcModule
• Connects the project (module) to the Kentico
application
Controllers
• Custom controllers
• Sample controller
Models
• Custom model classes
Views
• Custom views
• Sample views
Development tips #1
Architecture
• Kentico as a content platform
• Live site generated by MVC
Controllers
• Try out new DocumentQuery API
• Implement caching
o MVC caching
o Kentico caching
• When using view location that support Kentico export, return full path of views
Models
• Use Kentico API classes (info objects)
• Is using data containers (TreeNode), create a simplified model class => strongly typed views
Development tips #2
Views
• View engines – no restrictions
• Razor recommended
Routes
• Route registration
o App_Start/RouteConfig.cs – manual export
o Attribute routing
• Avoid using route placeholders at the start of the route: {controller}/{action}/{id}
• Especially when using together with extension-less
• Otherwise use the following route restrictions (solves most of the future possible conflicts with system URLs)
routes.IgnoreRoute("{*allaspx}", new {allaspx=@".*.aspx(/.*)?"});
routes.IgnoreRoute("{*allashx}", new { allashx = @".*.ashx(/.*)?" });
• To improve performance, exclude the URLs defined by your routes from the Kentico rewriting engine
Example
Controller
• Data - DocumentQuery
• No caching
• Location
o Controllers/MvcSampleSite/NewsController.cs
Model
• News document model
• Location
o MvcSampleSite/Model/NewsModel.cs
View
• Strongly typed view
• Using a layout page
• Location
o Views/MvcSampleSite/*
Routes
• Registered news list + news detail routes
o / - news list
o /news/<newsalias> - news detail
• Location
o App_Start/RouteConfig.cs
MVC limitations
MVC Views
• No web parts
• No CMS controls
• Document permissions need to be checked manually
Web parts
• No MVC views
Web forms
(web parts)
MVC
Export/Import
Export
Site objects
• Controllers/<siteName>/*
• Views/<siteName>/*
• <siteName>/*
Global objects
• Controllers/Global/*
• Views/Global/*
Import
• Manually include files into CMSApp_MVC
• Build CMSApp_MVC
MVC upgrade
MVC Upgrade
Remove MVC4 libraries (Lib/MVC/)
NuGet package
• Recommended
• Easier option
• Only latest MVC version
Manual MVC upgrade
• More complicated
• Specific MVC version
Update Kentico MVC library
Update Views/web.config
Rebuild CMSApp_MVC
Resources
Kentico MVC
https://docs.kentico.com/x/qYFG
Upgrade MVC
https://docs.kentico.com/x/UgBcAw
API examples
https://docs.kentico.com/x/VABcAw
Document API
https://docs.kentico.com/x/5oAbAg
Using MVC with Kentico 8

More Related Content

What's hot

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
 
Mortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazing
Mortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazingMortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazing
Mortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazing
Tom Walker
 
Mvc framework
Mvc frameworkMvc framework
Mvc framework
Dhurham Fahem
 
Asp.net mvc basic introduction
Asp.net mvc basic introductionAsp.net mvc basic introduction
Asp.net mvc basic introduction
Bhagath Gopinath
 
Asp .net web form fundamentals
Asp .net web form fundamentalsAsp .net web form fundamentals
Asp .net web form fundamentals
Gopal Ji Singh
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
Emad Alashi
 
Mvc
MvcMvc
Mvc
abhigad
 
Sitecore MVC: Converting Web Forms sublayouts
Sitecore MVC: Converting Web Forms sublayoutsSitecore MVC: Converting Web Forms sublayouts
Sitecore MVC: Converting Web Forms sublayouts
nonlinear creations
 
MVC Web Application
MVC Web ApplicationMVC Web Application
MVC Web Application
KLabCyscorpions-TechBlog
 
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
 
MVC Framework
MVC FrameworkMVC Framework
MVC Framework
Ashton Feller
 
Asp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin SawantAsp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin Sawant
Nitin Sawant
 
Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0
Shiju Varghese
 
Sitecore MVC (London User Group, April 29th 2014)
Sitecore MVC (London User Group, April 29th 2014)Sitecore MVC (London User Group, April 29th 2014)
Sitecore MVC (London User Group, April 29th 2014)
Ruud van Falier
 
ASP .NET MVC
ASP .NET MVC ASP .NET MVC
ASP .NET MVC
eldorina
 
Asp 1a-aspnetmvc
Asp 1a-aspnetmvcAsp 1a-aspnetmvc
Asp 1a-aspnetmvc
Fajar Baskoro
 
Eloquent workflow: delivering data from database to client in a right way
Eloquent workflow: delivering data from database to client in a right wayEloquent workflow: delivering data from database to client in a right way
Eloquent workflow: delivering data from database to client in a right way
Роман Кинякин
 
.net training | learn .net | Microsoft dot net Course | Microsoft dot net onl...
.net training | learn .net | Microsoft dot net Course | Microsoft dot net onl....net training | learn .net | Microsoft dot net Course | Microsoft dot net onl...
.net training | learn .net | Microsoft dot net Course | Microsoft dot net onl...
Nancy Thomas
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handson
Prashant Kumar
 
Asp.net,mvc
Asp.net,mvcAsp.net,mvc
Asp.net,mvc
Prashant Kumar
 

What's hot (20)

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
 
Mortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazing
Mortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazingMortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazing
Mortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazing
 
Mvc framework
Mvc frameworkMvc framework
Mvc framework
 
Asp.net mvc basic introduction
Asp.net mvc basic introductionAsp.net mvc basic introduction
Asp.net mvc basic introduction
 
Asp .net web form fundamentals
Asp .net web form fundamentalsAsp .net web form fundamentals
Asp .net web form fundamentals
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
 
Mvc
MvcMvc
Mvc
 
Sitecore MVC: Converting Web Forms sublayouts
Sitecore MVC: Converting Web Forms sublayoutsSitecore MVC: Converting Web Forms sublayouts
Sitecore MVC: Converting Web Forms sublayouts
 
MVC Web Application
MVC Web ApplicationMVC Web Application
MVC Web Application
 
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
 
MVC Framework
MVC FrameworkMVC Framework
MVC Framework
 
Asp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin SawantAsp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin Sawant
 
Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0
 
Sitecore MVC (London User Group, April 29th 2014)
Sitecore MVC (London User Group, April 29th 2014)Sitecore MVC (London User Group, April 29th 2014)
Sitecore MVC (London User Group, April 29th 2014)
 
ASP .NET MVC
ASP .NET MVC ASP .NET MVC
ASP .NET MVC
 
Asp 1a-aspnetmvc
Asp 1a-aspnetmvcAsp 1a-aspnetmvc
Asp 1a-aspnetmvc
 
Eloquent workflow: delivering data from database to client in a right way
Eloquent workflow: delivering data from database to client in a right wayEloquent workflow: delivering data from database to client in a right way
Eloquent workflow: delivering data from database to client in a right way
 
.net training | learn .net | Microsoft dot net Course | Microsoft dot net onl...
.net training | learn .net | Microsoft dot net Course | Microsoft dot net onl....net training | learn .net | Microsoft dot net Course | Microsoft dot net onl...
.net training | learn .net | Microsoft dot net Course | Microsoft dot net onl...
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handson
 
Asp.net,mvc
Asp.net,mvcAsp.net,mvc
Asp.net,mvc
 

Similar to Using MVC with Kentico 8

Aspnetmvc 1
Aspnetmvc 1Aspnetmvc 1
Aspnetmvc 1
Fajar Baskoro
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
Rasel Khan
 
Sitecore MVC: What it is and why it's important
Sitecore MVC: What it is and why it's importantSitecore MVC: What it is and why it's important
Sitecore MVC: What it is and why it's important
nonlinear creations
 
ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!
Fioriela Bego
 
ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!
Commit Software Sh.p.k.
 
MVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming modelMVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming model
Alex Thissen
 
Fast Track introduction to ASP.NET MVC
Fast Track introduction to ASP.NET MVCFast Track introduction to ASP.NET MVC
Fast Track introduction to ASP.NET MVC
Ankit Kashyap
 
Mvc
MvcMvc
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
Sirwan Afifi
 
MVC 6 Introduction
MVC 6 IntroductionMVC 6 Introduction
MVC 6 Introduction
Sudhakar Sharma
 
Aspnet mvc
Aspnet mvcAspnet mvc
Aspnet mvc
Hiep Luong
 
Targeting Mobile Platform with MVC 4.0
Targeting Mobile Platform with MVC 4.0Targeting Mobile Platform with MVC 4.0
Targeting Mobile Platform with MVC 4.0
Mayank Srivastava
 
ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)
Hatem Hamad
 
Mvc Brief Overview
Mvc Brief OverviewMvc Brief Overview
Mvc Brief Overview
rainynovember12
 
Mvc fundamental
Mvc fundamentalMvc fundamental
Mvc fundamental
Nguyễn Thành Phát
 
Sitecore mvc
Sitecore mvcSitecore mvc
Sitecore mvc
pratik satikunvar
 
Session 1
Session 1Session 1
Session 1
Asif Atick
 
Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1
asim78
 
Mastering asp.net mvc - Dot Net Tricks
Mastering asp.net mvc - Dot Net TricksMastering asp.net mvc - Dot Net Tricks
Mastering asp.net mvc - Dot Net Tricks
Gaurav Singh
 
Mvc presentation
Mvc presentationMvc presentation
Mvc presentation
MaslowB
 

Similar to Using MVC with Kentico 8 (20)

Aspnetmvc 1
Aspnetmvc 1Aspnetmvc 1
Aspnetmvc 1
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
 
Sitecore MVC: What it is and why it's important
Sitecore MVC: What it is and why it's importantSitecore MVC: What it is and why it's important
Sitecore MVC: What it is and why it's important
 
ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!
 
ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!
 
MVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming modelMVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming model
 
Fast Track introduction to ASP.NET MVC
Fast Track introduction to ASP.NET MVCFast Track introduction to ASP.NET MVC
Fast Track introduction to ASP.NET MVC
 
Mvc
MvcMvc
Mvc
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
 
MVC 6 Introduction
MVC 6 IntroductionMVC 6 Introduction
MVC 6 Introduction
 
Aspnet mvc
Aspnet mvcAspnet mvc
Aspnet mvc
 
Targeting Mobile Platform with MVC 4.0
Targeting Mobile Platform with MVC 4.0Targeting Mobile Platform with MVC 4.0
Targeting Mobile Platform with MVC 4.0
 
ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)
 
Mvc Brief Overview
Mvc Brief OverviewMvc Brief Overview
Mvc Brief Overview
 
Mvc fundamental
Mvc fundamentalMvc fundamental
Mvc fundamental
 
Sitecore mvc
Sitecore mvcSitecore mvc
Sitecore mvc
 
Session 1
Session 1Session 1
Session 1
 
Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1
 
Mastering asp.net mvc - Dot Net Tricks
Mastering asp.net mvc - Dot Net TricksMastering asp.net mvc - Dot Net Tricks
Mastering asp.net mvc - Dot Net Tricks
 
Mvc presentation
Mvc presentationMvc presentation
Mvc presentation
 

More from Thomas Robbins

PlayFab Advanced Cloud Script
PlayFab Advanced Cloud ScriptPlayFab Advanced Cloud Script
PlayFab Advanced Cloud Script
Thomas Robbins
 
What’s in the box? Creating chance mechanics and rewards
What’s in the box? Creating chance mechanics and rewardsWhat’s in the box? Creating chance mechanics and rewards
What’s in the box? Creating chance mechanics and rewards
Thomas Robbins
 
Getting started with Cloud Script
Getting started with Cloud ScriptGetting started with Cloud Script
Getting started with Cloud Script
Thomas Robbins
 
Say hello to the new PlayFab!
Say hello to the new PlayFab!Say hello to the new PlayFab!
Say hello to the new PlayFab!
Thomas Robbins
 
Data-Driven Government: Explore the Four Pillars of Value
Data-Driven Government: Explore the Four Pillars of ValueData-Driven Government: Explore the Four Pillars of Value
Data-Driven Government: Explore the Four Pillars of Value
Thomas Robbins
 
Financial Transparency Trailblazers
Financial Transparency TrailblazersFinancial Transparency Trailblazers
Financial Transparency Trailblazers
Thomas Robbins
 
Telling Stories with Open Data
Telling Stories with Open DataTelling Stories with Open Data
Telling Stories with Open Data
Thomas Robbins
 
Socrata Financial Transparency Suite
Socrata Financial Transparency Suite Socrata Financial Transparency Suite
Socrata Financial Transparency Suite
Thomas Robbins
 
Socrata Service Connect
Socrata Service ConnectSocrata Service Connect
Socrata Service Connect
Thomas Robbins
 
Leveraging Data to Engage Citizens and Drive Innovation
Leveraging Data to Engage Citizens and Drive InnovationLeveraging Data to Engage Citizens and Drive Innovation
Leveraging Data to Engage Citizens and Drive Innovation
Thomas Robbins
 
Here Comes Kentico 8
Here Comes Kentico 8Here Comes Kentico 8
Here Comes Kentico 8
Thomas Robbins
 
Say hello to Kentico 8! Your integrated marketing solution has arrived
Say hello to Kentico 8! Your integrated marketing solution has arrivedSay hello to Kentico 8! Your integrated marketing solution has arrived
Say hello to Kentico 8! Your integrated marketing solution has arrived
Thomas Robbins
 
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico mobil...
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico   mobil...One Size does Not Fit All: Selecting the Right Mobile StrategyKentico   mobil...
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico mobil...
Thomas Robbins
 
Digital marketing best practices
Digital marketing best practices Digital marketing best practices
Digital marketing best practices
Thomas Robbins
 
Do you speak digital marketing with Kentico CMS?
Do you speak digital marketing with Kentico CMS?Do you speak digital marketing with Kentico CMS?
Do you speak digital marketing with Kentico CMS?
Thomas Robbins
 
Common questions for Windows Azure and Kentico CMS
Common questions for Windows Azure and Kentico CMSCommon questions for Windows Azure and Kentico CMS
Common questions for Windows Azure and Kentico CMS
Thomas Robbins
 
Advanced development with Windows Azure
Advanced development with Windows AzureAdvanced development with Windows Azure
Advanced development with Windows Azure
Thomas Robbins
 
Best Practices for Kentico CMS and Windows Azure
Best Practices for Kentico CMS and Windows AzureBest Practices for Kentico CMS and Windows Azure
Best Practices for Kentico CMS and Windows Azure
Thomas Robbins
 
Deployment options for Kentico CMS on Windows Azure
Deployment options for Kentico CMS on Windows AzureDeployment options for Kentico CMS on Windows Azure
Deployment options for Kentico CMS on Windows Azure
Thomas Robbins
 
Go…Running Kentico CMS on Windows Azure
Go…Running Kentico CMS on Windows AzureGo…Running Kentico CMS on Windows Azure
Go…Running Kentico CMS on Windows Azure
Thomas Robbins
 

More from Thomas Robbins (20)

PlayFab Advanced Cloud Script
PlayFab Advanced Cloud ScriptPlayFab Advanced Cloud Script
PlayFab Advanced Cloud Script
 
What’s in the box? Creating chance mechanics and rewards
What’s in the box? Creating chance mechanics and rewardsWhat’s in the box? Creating chance mechanics and rewards
What’s in the box? Creating chance mechanics and rewards
 
Getting started with Cloud Script
Getting started with Cloud ScriptGetting started with Cloud Script
Getting started with Cloud Script
 
Say hello to the new PlayFab!
Say hello to the new PlayFab!Say hello to the new PlayFab!
Say hello to the new PlayFab!
 
Data-Driven Government: Explore the Four Pillars of Value
Data-Driven Government: Explore the Four Pillars of ValueData-Driven Government: Explore the Four Pillars of Value
Data-Driven Government: Explore the Four Pillars of Value
 
Financial Transparency Trailblazers
Financial Transparency TrailblazersFinancial Transparency Trailblazers
Financial Transparency Trailblazers
 
Telling Stories with Open Data
Telling Stories with Open DataTelling Stories with Open Data
Telling Stories with Open Data
 
Socrata Financial Transparency Suite
Socrata Financial Transparency Suite Socrata Financial Transparency Suite
Socrata Financial Transparency Suite
 
Socrata Service Connect
Socrata Service ConnectSocrata Service Connect
Socrata Service Connect
 
Leveraging Data to Engage Citizens and Drive Innovation
Leveraging Data to Engage Citizens and Drive InnovationLeveraging Data to Engage Citizens and Drive Innovation
Leveraging Data to Engage Citizens and Drive Innovation
 
Here Comes Kentico 8
Here Comes Kentico 8Here Comes Kentico 8
Here Comes Kentico 8
 
Say hello to Kentico 8! Your integrated marketing solution has arrived
Say hello to Kentico 8! Your integrated marketing solution has arrivedSay hello to Kentico 8! Your integrated marketing solution has arrived
Say hello to Kentico 8! Your integrated marketing solution has arrived
 
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico mobil...
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico   mobil...One Size does Not Fit All: Selecting the Right Mobile StrategyKentico   mobil...
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico mobil...
 
Digital marketing best practices
Digital marketing best practices Digital marketing best practices
Digital marketing best practices
 
Do you speak digital marketing with Kentico CMS?
Do you speak digital marketing with Kentico CMS?Do you speak digital marketing with Kentico CMS?
Do you speak digital marketing with Kentico CMS?
 
Common questions for Windows Azure and Kentico CMS
Common questions for Windows Azure and Kentico CMSCommon questions for Windows Azure and Kentico CMS
Common questions for Windows Azure and Kentico CMS
 
Advanced development with Windows Azure
Advanced development with Windows AzureAdvanced development with Windows Azure
Advanced development with Windows Azure
 
Best Practices for Kentico CMS and Windows Azure
Best Practices for Kentico CMS and Windows AzureBest Practices for Kentico CMS and Windows Azure
Best Practices for Kentico CMS and Windows Azure
 
Deployment options for Kentico CMS on Windows Azure
Deployment options for Kentico CMS on Windows AzureDeployment options for Kentico CMS on Windows Azure
Deployment options for Kentico CMS on Windows Azure
 
Go…Running Kentico CMS on Windows Azure
Go…Running Kentico CMS on Windows AzureGo…Running Kentico CMS on Windows Azure
Go…Running Kentico CMS on Windows Azure
 

Recently uploaded

[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
DianaGray10
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
Ajin Abraham
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
operationspcvita
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
BibashShahi
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 

Recently uploaded (20)

[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 

Using MVC with Kentico 8

  • 1. MVC with Kentico 8 Thomas Robbins Radek Pribyl
  • 2. Introduction to MVC Thomas Robbins thomasr@Kentico.com
  • 3. A history lesson.. ASP.NET Web Form • A set of UI components (pages, buttons etc.) plus a stateful object oriented GUI programming model ASP.NET • A way to host .NET application in IIS that let’s you interact with HTTP requests and responses .NET • A multi-language managed code platform The Strength of ASP.NET Web Forms • Making web development feel the same as Windows Form development • No need to work with individual HTTP requests and easier to think in terms of a stateful UI
  • 4. Some problems with ASP.NET Web Forms View state weight – Mechanism for maintaining state (view state) results in large blocks of data between client and server Page life cycle – Connecting client side events with server side event handler code is complicated and delicate False sense of separation – ASP.NET web Forms code behind model provides a means to take application code out of HTML markup. Unfortunately, this allows for mix presentation models (manipulating a server side tree) Limited control over HTML – Server side controls render themselves as HTML but not always the HTML you want Low testability – Nobody could have anticipated that automated testing would become essential Not all bad – ASP.NET Web Forms provide a quick results and allows reasonably complex web applications to be built quickly!
  • 5. What matters most… Code reusability • Shortens development • Code libraries • Design patterns • Frameworks Separation of concerns • Improves code clarity and organization • Helps troubleshoot by isolating issues • Allows for multiple teams to develop simultaneously
  • 6. What is MVC? Model represents the data model • “Manages behavior and data of the application domain” View represents the screen shown to the user • “Manages the graphical and/or textual output to the portion of the bitmapped display that is allocated to the application” Controller represents interaction from the user that changes the data and the view • “Interprets the mouse and keyboard inputs from the user, commanding the model and/or the view to changes as appropriate”
  • 7. MVC isn’t new! Presented by Trygve Reenskaug in 1979 First used in the Smalltalk-80 framework • Used in making Apple interfaces (Lisa and Macintosh)
  • 8. MVC Step by Step
  • 10. The project structure • App_Data is the physical store for data. This folder has the same role as it does in ASP.NET web sites that use Web Form pages • Content is the recommended location to add static content files like CSS and images • Controllers is the recommended location for controllers. All controllers must end with “Controller” • Models is provided for classes that represent the application model. This folder usually contains code that defines objects and logic for application with the data store • Scripts is the recommended location for script files that support the application. By default this folder contains ASP.NET Ajax Foundation files and Jquery • Views is the recommended location for views. These are ViewPage (.aspx), ViewUserControl (.ascx) and ViewMaster (.master) in additional to any other files needed for renderings. The view folder also contains a folder for each controller.
  • 11. MVC • Easier to Manage Complexity • Does not use view state or server based forms • Rich Routing Structure • Support for Test-Driven Development • Supports Large Teams Well WebForms • Preservers State over HTTP • Page Controller Pattern • View state or server based forms • Works well for small teams • Development is less complex Everything has it’s advantages
  • 12. MVC Routes • A route is an object that parses a requested URL and it determines the controller and action to which the request is forwarded • Routing operates on the directories and the file name of tin the relative URL Uses the format /[Controller]/[ActionName]/[Parameters]
  • 13. What’s the route Matching a URL request to a route depends on all of the following conditions: • The route patterns that you have defined or the default route patterns, if any, that are included in your project type. • The order in which you added them to the Routes collection. • Any default values that you have provided for a route. • Any constraints that you have provided for a route. • Whether you have defined routing to handle requests that match a physical file.
  • 14. MVC in Kentico 8 Radek Pribyl (Technical leader - Portal engine, MVC)
  • 15. Installation Requirements • .NET Framework 4.5/4.5.1 • Project type – Web application Configuration • None MVC version • MVC4 included in the Kentico 8 installation
  • 16. Architecture Kentico as a content platform • Data stored in documents and custom tables MVC renders live site • Controller, Views – custom implementation • Manual routing management recommended MVC handler Request Live site (MVC) ASPX handler CMS Core Kentico Admin (Web forms) HTML…
  • 17. Web application sructure CMSApp • Standard Kentico web application project (Web forms) CMSApp_AppCode • Contains all the files which you would place into the ASP.NET folder Old_App_Code (or App_Code in Web site project) CMSApp_MVC • MVC4 web application project • Standard Kentico module – registered in the Kentico application => uses API handlers • Simplifies development • All the MVC related files belong here • NewsController + Views examples – used in the Corporate sample site
  • 18. CMSApp_MVC project App_Start • Standard MVC project folder • RouteConfig.cs • FilterConfig.cs CMS_MvcModule • Connects the project (module) to the Kentico application Controllers • Custom controllers • Sample controller Models • Custom model classes Views • Custom views • Sample views
  • 19. Development tips #1 Architecture • Kentico as a content platform • Live site generated by MVC Controllers • Try out new DocumentQuery API • Implement caching o MVC caching o Kentico caching • When using view location that support Kentico export, return full path of views Models • Use Kentico API classes (info objects) • Is using data containers (TreeNode), create a simplified model class => strongly typed views
  • 20. Development tips #2 Views • View engines – no restrictions • Razor recommended Routes • Route registration o App_Start/RouteConfig.cs – manual export o Attribute routing • Avoid using route placeholders at the start of the route: {controller}/{action}/{id} • Especially when using together with extension-less • Otherwise use the following route restrictions (solves most of the future possible conflicts with system URLs) routes.IgnoreRoute("{*allaspx}", new {allaspx=@".*.aspx(/.*)?"}); routes.IgnoreRoute("{*allashx}", new { allashx = @".*.ashx(/.*)?" }); • To improve performance, exclude the URLs defined by your routes from the Kentico rewriting engine
  • 21. Example Controller • Data - DocumentQuery • No caching • Location o Controllers/MvcSampleSite/NewsController.cs Model • News document model • Location o MvcSampleSite/Model/NewsModel.cs View • Strongly typed view • Using a layout page • Location o Views/MvcSampleSite/* Routes • Registered news list + news detail routes o / - news list o /news/<newsalias> - news detail • Location o App_Start/RouteConfig.cs
  • 22. MVC limitations MVC Views • No web parts • No CMS controls • Document permissions need to be checked manually Web parts • No MVC views Web forms (web parts) MVC
  • 23. Export/Import Export Site objects • Controllers/<siteName>/* • Views/<siteName>/* • <siteName>/* Global objects • Controllers/Global/* • Views/Global/* Import • Manually include files into CMSApp_MVC • Build CMSApp_MVC
  • 24. MVC upgrade MVC Upgrade Remove MVC4 libraries (Lib/MVC/) NuGet package • Recommended • Easier option • Only latest MVC version Manual MVC upgrade • More complicated • Specific MVC version Update Kentico MVC library Update Views/web.config Rebuild CMSApp_MVC
  • 25. Resources Kentico MVC https://docs.kentico.com/x/qYFG Upgrade MVC https://docs.kentico.com/x/UgBcAw API examples https://docs.kentico.com/x/VABcAw Document API https://docs.kentico.com/x/5oAbAg