ASP.NET Core MVC Interview

Advanced Routing, Filters, Areas & Application Structure

ASP.NET Core MVC interview questions covering advanced routing, filters, areas & application structure.

25 Questions Filter by level

Interview questions

Open a question for the full answer, code and interview guidance.

25 Results
76
Mid-LevelIntermediate

What is advanced routing in ASP.NET Core MVC?

Advanced routing goes beyond the basic {controller}/{action}/{id?} pattern and uses route constraints, named routes, route order, attribute templates, areas, parameter transformers, and custom routing conventions to create precise URL structures.

77
Mid-LevelIntermediate

What are route constraints in ASP.NET Core MVC?

Route constraints restrict which values can match a route parameter. Common constraints include int, guid, bool, datetime, length, min, max, and regex-based constraints.

78
Mid-LevelIntermediate

What is the difference between an optional route parameter and a default route value?

An optional route parameter uses ? to indicate that the URL segment may be absent. A default route value supplies a value when a route segment is not present.

79
Mid-LevelIntermediate

What are named routes and when are they useful?

A named route gives a route a stable identifier that can be used for URL generation or redirects. This is useful when code should target a particular route definition rather than depend on controller/action discovery.

80
Mid-LevelIntermediate

What are route tokens such as [controller] and [action]?

Attribute routing supports replacement tokens such as [controller], [action], and [area]. At application startup, MVC replaces these tokens with values derived from the controller, action, or area.

81
Mid-LevelIntermediate

What is a route parameter transformer?

A route parameter transformer can change how route values are represented during URL generation. A common example is converting PascalCase controller or action names into kebab-case URLs.

82
Mid-LevelIntermediate

How does route order affect MVC endpoint matching?

When multiple endpoints could match a request, routing uses endpoint precedence, order, constraints, and other metadata to select the best candidate. More specific route patterns generally take precedence over broader patterns.

83
Mid-LevelIntermediate

What is URL generation in ASP.NET Core MVC?

URL generation creates a URL from route values instead of hard-coding a path. MVC helpers such as Url.Action, RedirectToAction, anchor Tag Helpers, and LinkGenerator use the configured endpoints to generate URLs.

84
Mid-LevelIntermediate

What is LinkGenerator in ASP.NET Core?

LinkGenerator is a routing service that can generate paths or absolute URIs outside of Razor Tag Helpers and controller convenience methods. It is useful in services that need to generate application links, such as notification or email workflows.

85
Mid-LevelIntermediate

What are Areas in ASP.NET Core MVC?

Areas divide a large MVC application into functional sections, each with its own controllers, views, and routing. Common examples include Admin, Customer, Staff, or Management sections.

86
Mid-LevelIntermediate

What is the typical folder structure for an MVC Area?

An area commonly contains its own Controllers, Views, and optionally Models or other feature-specific folders beneath Areas/{AreaName}. Views normally follow the same controller-based convention inside the area's Views folder.

87
Mid-LevelIntermediate

How do you configure routing for Areas?

A conventional area route includes an {area:exists} segment and is normally mapped before the application's general default route. Attribute routing can also include [area] or explicit area templates.

88
Mid-LevelIntermediate

How do you create a link to an action inside an Area?

Use the asp-area Tag Helper together with asp-controller and asp-action. This ensures that URL generation includes the intended area route value.

89
Mid-LevelIntermediate

Do Areas provide security or authorization automatically?

No. Areas are an organizational and routing feature, not a security boundary. An Admin area is not protected merely because its URL begins with /Admin.

90
Mid-LevelIntermediate

What are MVC filters?

MVC filters are components that run at defined stages around MVC action execution. They support cross-cutting concerns that are specific to MVC, such as authorization, resource handling, action execution, exception handling, and result processing.

91
Mid-LevelIntermediate

What are the main types of filters in ASP.NET Core MVC?

The main MVC filter categories are authorization filters, resource filters, action filters, exception filters, and result filters. They execute at different points in the MVC pipeline and therefore solve different problems.

92
Mid-LevelIntermediate

What is an authorization filter?

An authorization filter runs early in the MVC filter pipeline and determines whether the current request is authorized to continue. In most applications, authorization should be expressed through ASP.NET Core authorization policies and the Authorize attribute rather than custom authorization-filter logic.

93
Mid-LevelIntermediate

What is an action filter?

An action filter runs immediately before and/or after an MVC action method executes. It can inspect action arguments, ModelState, controller information, and the resulting action result.

94
Mid-LevelIntermediate

What is a resource filter?

A resource filter runs after authorization and surrounds much of the remaining MVC pipeline. Because it executes before model binding, it can be useful for concerns such as caching or short-circuiting expensive MVC processing.

95
Mid-LevelIntermediate

What is an exception filter?

An exception filter can observe or handle unhandled exceptions that occur during parts of MVC action processing. It can convert an exception into an MVC result by marking the exception as handled.

96
Mid-LevelIntermediate

What is a result filter?

A result filter runs before and after execution of an MVC action result. It can inspect or modify result processing for supported result types.

97
Mid-LevelIntermediate

What is the difference between synchronous and asynchronous MVC filters?

MVC provides synchronous filter interfaces such as IActionFilter and asynchronous equivalents such as IAsyncActionFilter. An asynchronous filter should be used when its work requires asynchronous I/O.

98
Mid-LevelIntermediate

How can filters be registered globally, on controllers, or on actions?

Global filters are added to MVC options and apply broadly to MVC requests. Attribute-based filters can be placed on a controller to affect all of its actions or on a specific action for narrower scope.

99
Mid-LevelIntermediate

What is the difference between TypeFilter and ServiceFilter?

ServiceFilter resolves the filter itself from dependency injection, so the filter type must be registered as a service. TypeFilter can create the specified filter type using ObjectFactory while resolving its constructor dependencies from DI; the filter type itself does not have to be registered in the same way.

100
Mid-LevelIntermediate

What are best practices for MVC routing, Areas, filters, and application structure?

Keep public routes predictable and unambiguous, use constraints when they improve endpoint selection, and generate URLs through routing rather than hard-coding paths. Use Areas to organize genuinely large functional sections, but apply explicit authorization because an area is not a security boundary.