Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
ASP.NET Core 2 Fundamentals

You're reading from   ASP.NET Core 2 Fundamentals Build cross-platform apps and dynamic web services with this server-side web application framework

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher
ISBN-13 9781789538915
Length 298 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Onur Gumus Onur Gumus
Author Profile Icon Onur Gumus
Onur Gumus
Mugilan T. S. Ragupathi Mugilan T. S. Ragupathi
Author Profile Icon Mugilan T. S. Ragupathi
Mugilan T. S. Ragupathi
Arrow right icon
View More author details
Toc

Introduction to Routing

The routing engine is responsible for getting the incoming request and routing that request to the appropriate controller based on the URL pattern. We can configure the routing engine so that it can choose the appropriate controller based on the relevant information. In other words, routing is a programmatic mapping that states which method of which controller is to be invoked based on some URL pattern.

By convention, ASP.NET MVC follows this pattern: Controller/Action/Id.

If the user types the URL http://yourwebsite.com/Hello/Greeting/1, the routing engine selects the Hello controller class and Greeting action method within the Hello controller, and passes the Id value as 1. XXXController is a naming convention and it is assumed your controllers are always ending with a controller suffix. You can give default values to some of the parameters and make some...

You have been reading a chapter from
ASP.NET Core 2 Fundamentals
Published in: Aug 2018
Publisher:
ISBN-13: 9781789538915
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime