19 CEO Dashboard Examples for Business Leaders
Let's rewind to the 1990s. Data used to be stored on servers and CEOs relied on basic tools to make optimal decisions. No dashboards, nothing. When you use Power BI with a solid...
Kapil Panchal - November 11, 2020
Listening is fun too.
Straighten your back and cherish with coffee - PLAY !
The routing is a mechanism in which it inspects the incoming Requests path and then map that request to the controllers and action methods. This mapping is done by the routing rules which are defined for the application. We can do this by add the Routing in Middleware to the request processing pipeline.
So, this Framework maps the incoming Request and URL to the Controllers action methods based on the routes configured in your application. You can configure the multiple routes for your application and for each route you can also set some specific configurations such as default values, constraints, message handlers, etc.
There are two types of routing:
When the Request arrives at the Routing Middleware it does the following steps.
The Route is similar to a roadmap. We used a roadmap to reach our destination similarly, the ASP.NET Core apps uses the Route to reach the controller action.
The Route Collection is a collection of all the Routes in the Application. The app maintains a single in-memory collection of Routes and Routes are added to this collection when the application starts. The Routing Module looks for a Route that matches the incoming request URL on each available Route in the Route collection.
The Route Collection is defined in the Microsoft.AspNetcore.routing namespace
The Route Handler is a component that decides what to do with the route.The routing Engine locates the Route for an incoming request and it invokes the associated RouteHandler and passes the Route for further processing. Route handler is a class which implements the IRouteHandler interface.In the ASP.NET Core, Routes are handled the MvcRouteHandler.
This is a default Route Handler for the ASP.NET Core MVC Middleware.The MVCRouteHandler is a registered when we register the MVC Middleware in the Request Pipeline. You can override and create your own implementation of the Route Handler.
The MVCRouteHandler is defined in the Microsoft.AspnetCore.mvc namespace.MVCRouteHandler is responsible for invoking the Controller Factory, which in turn creates the instance of the Controller associated to Route. The Controller then takes over and invoke the Action method to generate the View and Complete the Request.
The conventional routing is determined based on the conventions defined in the route templates which will map the incoming Requests path to controllers and their action methods. This convention based to routes are defined within the Configure method of the Startup.cs class file.
The conventional Routing establishes a convention for the URL path, such that given a template:
This route is determined based on the attributes which are configured either at the controller level or at the action method level and we can use both Conventional Routing and Attribute Routing in a single application.
Attribute routing maps the URLs by applying routing template directly on the controller and action. There is an existence of controller and action in the template is not mandatory for the attribute routing, as they don’t play any part in the routing process.
We can use the [Route] or [HttpGet] (and other verbs) attributes to specify templates. This template can also have literals and tokens (except for controller and action tokens).
Attribute apply to the controller are merged with those on an action for E.g.In the HomeController, PageOne action can be access via /home/one URL.
Step 1: -Open visual studio and click on File ->New->Project menu option
A new Project Dialog will open.
Step 2:-Then, select ASP.NET WEB Application (.NET Framework)
Step 3:- Enter project name RoutingDemo1 in the Name Field and click ok to continue and you will see the dialog.
Step 4: - Select Empty option and check the MVC checkbox then click Ok
step 5: - select the MVC 5 Controller -> Empty option and click on ADD button The Add controller dialog will open.
Step 6: - set the Name to StudentController and click on add button
StudentController.cs
namespace Routing_Demo.Controllers { public class StudentController : Controller { // GET: Student public ActionResult student() { return View(); } } }
In Views/Student/Student.cshtml, replace the contents of the file with the following code to replace the text about ASP.NET and MVC with text about thisapplication
RouteConfig.cs
Once these are in place, let’s change the route name is default1 and url is api in the RouteConfig.cs
publicclassRouteConfig { publicstaticvoidRegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default1", url: "api/", defaults: new{ controller = "Student", action = "student", id = UrlParameter.Optional } ); } }
Now let’s run the application. We can see the callstudent () method of the StudentController.
Routing is a process through which the application matches an incoming URL path and executes the corresponding action methods. The use of routing is middleware to match the URLs of incoming requests and map to specific action methods. Here in this blog, you have learned about the types of Routing and its working.
Build Your Agile Team
Let's rewind to the 1990s. Data used to be stored on servers and CEOs relied on basic tools to make optimal decisions. No dashboards, nothing. When you use Power BI with a solid...
Imagine walking into a meeting where critical decisions need to be made—fast. You need clear, flexible data that you can analyze on the spot. But what if your insights are locked inside...
Clear insights mean smarter decisions, and this is what data storytelling does. It helps you speak a language that you quickly understand. Like for example, you are a CTO dealing with...