Create an AreaRegistration class
You create the AreaRegistration class to map one or more routes. The routes define the template of the URL used to navigate to the different views.
To create an area registration class for your application:
- In Visual Studio, navigate to Areas » BugTracker folder and create a new class.
Name the classBugTrackerAreaRegistration. - Make your class inherit the
AreaRegistrationclass.
TheAreaRegistrationclass is located under theSystem.Web.Mvcnamespace. - Implement the abstract members of the
AreaRegistrationclass.
TheAreaRegistrationclass has the following abstract members:AreaName
A property that returns the name of your area.RegisterArea
A method that is used to map a route for your area.
- Configure the
AreaNameproperty to return the name of your area.
In thegetterof the property, return the“BugTracker”value. - In the
RegisterAreamethod, map a route for your area:- Call the
MapRoutemethod of the context argument. - As the
nameargument pass the name of your route. - As the
urlargument pass the template of your URLs. - As the
defaultsargument pass the default values for theactionand theidelements of the URL.
The default action in theBugTrackersample isIndex(that is, querying of the available content items) and the default ID is an empty string.
- Call the
**GITHUB EXAMPLE:**For more information about the content of the file, see the BugTrackerAreaRegistration.cs file of the downloaded sample project.
Want to learn more?
Enhance your Sitefinity skills by enrolling in free training sessions. Become Sitefinity certified through Progress Education Community to strengthen your professional credentials.
Get started with Integration Hub | Sitefinity Cloud
This free lesson teaches administrators, marketers, and other business professionals how to use Sitefinity Integration Hub to create automated workflows between Sitefinity and other business systems.
Web Security for Sitefinity Administrators
This free lesson teaches administrators the basics about protecting your Sitefinity instance and your sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
Foundations of Sitefinity ASP.NET Core Development
The free on-demand video course teaches developers how to use Sitefinity ASP.NET Core and take advantage of its decoupled architecture and modern development model.