.NET

ASP.NET Core Fundamentals

Controllers, Actions, Routing, Middleware, Dependency Injection, Configuration

18 면접 질문·
Junior
1

What is a Controller in ASP.NET Core?

답변

A Controller is a class that handles incoming HTTP requests and returns responses. It contains action methods (Actions) that process specific requests and generate content (HTML, JSON, etc.). Controllers inherit from ControllerBase for APIs or from Controller for MVC applications with views.

2

What does an Action represent in an ASP.NET Core Controller?

답변

An Action is a public method in a Controller that processes a specific HTTP request. It can return different types of results (IActionResult, ActionResult<T>, typed object). Actions are mapped to routes via conventional routing or route attributes.

3

What is the difference between ControllerBase and Controller in ASP.NET Core?

답변

ControllerBase is the minimal base class for Web APIs that provides essential functionalities (ModelState, Request, Response). Controller inherits from ControllerBase and adds functionalities for views (ViewBag, ViewData, View()). Using ControllerBase for APIs improves performance by avoiding unnecessary view-related code.

4

How to define a route with attribute routing in ASP.NET Core?

5

What does the route pattern "{controller=Home}/{action=Index}/{id?}" do?

+15 면접 질문

다음 면접을 위해 .NET을 마스터하세요

모든 질문, flashcards, 기술 테스트, 코드 리뷰 연습, 면접 시뮬레이터에 접근하세요.

무료로 시작하기