routing in asp.net mvc Options
routing in asp.net mvc Options
Blog Article
Meaning if we navigate to the applying’s root URL, as shown beneath, then that ask for will be dealt with by default via the Index action way of the house Controller course.
The MapControllerRoute system is invoked through the appliance startup method to determine the route templates and their corresponding patterns. It registers all of the route templates into your route table after when the appliance starts.
This part discusses how routing interacts with areas. See Regions for information about how locations are utilized with views.
To be able to accomplish this, we have to use optional parameters within our convention-primarily based routing by including a question mark “?” towards the optional route parameter constraint.
The following instance configures MVC to use the default traditional route and a place route for a location named Weblog:
You can also configure a tailor made route using the MapRoute extension system. You should provide at least two parameters in MapRoute, route name, and URL sample. The Defaults parameter is optional.
HomeController matches a list of URLs much like just what the default typical route controller=Residence / motion=Index / id? matches.
You could sign-up various customized routes with different names. Look at the following instance where by we register "College student" route.
Isn't going to supply routing in asp.net mvc buying assures for your execution of extensibility, all endpoints are processed at the same time.
The site route from the previous code is often a committed typical route. It can be termed a devoted typical route due to the fact:
This portion discusses how routing interacts with areas. See Locations for particulars about how areas are made use of with sights.
The preceding illustration of Url.Action assumes common routing. URL era works equally with attribute routing, however the concepts are unique. With traditional routing:
These key terms should not be used for url generations, product bound parameters, or best amount properties.
If there is not any match for that incoming HTTP request URL Sample, it returns a 404 HTTP status code into the customer. For a greater understanding, you should have a look at the subsequent diagram.