Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Answer: IConfiguration is automatically registered and injected via constructor. public MyService(IConfiguration config) { var key = config["MyKey"]; } What interviewers expect A clear definition tied to ASP.NET Core in…
dd custom validation and authorization filters using .AddEndpointFilter(). What interviewers expect A clear definition tied to ASP.NET Core in ASP.NET Core projects Trade-offs (performance, maintainability, security, cos…
SP.NET Core provides structured logging via ILogger<T>. public class MyService { private readonly ILogger<MyService> _logger; public MyService(ILogger<MyService> logger) => _logger = logger; public v…
Yes—result filters can wrap or modify responses. What interviewers expect A clear definition tied to ASP.NET Core in ASP.NET Core projects Trade-offs (performance, maintainability, security, cost) When you would and woul…
Answer: Occurs when two services depend on each other directly or indirectly. 🛠 Fix: Refactor to remove circular reference Use Lazy&lt;T&gt; or factory injection Split responsibilities What interviewers expect A…
filter that tracks performance of controller actions: public class ProfilingFilter : IAsyncActionFilter { public async Task OnActionExecutionAsync( ctionExecutingContext context, ActionExecutionDelegate next) { var sw =…
Use a mocking framework like Moq: var mockService = new Mock<IMyService>(); mockService.Setup(s => s.Get()).Returns("test"); var controller = new MyController(mockService.Object); Mocking helps isolate the unit…
MVC (Model-View-Controller) is a pattern for organizing code into: Model: Data and business logic View: UI rendering Controller: Input handling and app flow Built on a modular, cross-platform framework. Uses dependency i…
How does it differ from MVC in “older” ASP.NET? MVC (Model-View-Controller) is a pattern for organizing code into: Model: Data and business logic View: UI rendering Controller: Input handling and app flow 🔹 Key differen…
SP.NET Core 2.0. Each .cshtml file has an associated PageModel class (like a view + controller combined). Best for simple UI-focused apps or CRUD pages. ✅ Use Razor Pages for: Simpler, page-focused apps ✅ Use MVC for: Co…
When to use Razor Pages instead of MVC? Razor Pages is a page-based programming model introduced in ASP.NET Core 2.0. Each .cshtml file has an associated PageModel class (like a view + controller combined). Best for simp…
MVC Routing: Uses attribute routing or conventional routing. Example: endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); Razor Pages Routing: Based on folder structure. URL…
Answer: }"); Razor Pages Routing: Based on folder structure. URL /Products/Edit maps to /Pages/Products/Edit.cshtml. What interviewers expect A clear definition tied to ASP.NET Core in ASP.NET Core projects Trade-offs (p…
Answer: view or JSON). View: .cshtml file that renders HTML. View Component: Reusable mini-views with logic (like partials but with code-behind). What interviewers expect A clear definition tied to ASP.NET Core in ASP.NE…
Controller: Handles HTTP requests. Action Method: A method in the controller that returns a result (like a view or JSON). View: .cshtml file that renders HTML. View Component: Reusable mini-views with logic (like partial…
Tag Helpers: Use HTML-like syntax. Easier to read/maintain. <form asp-controller="Home" asp-action="Login"></form> HTML Helpers: C# methods used in Razor. @Html.BeginForm("Login", "Home") ✅ Prefer Tag Helpers…
ta cross requests No Preserved for 1 redirect only What interviewers expect A clear definition tied to ASP.NET Core in ASP.NET Core projects Trade-offs (performance, maintainability, security, cost) When you would and wo…
Answer: Purpose ViewDa Current request No Pass data to views ViewBa Current request Yes ViewData wrapper (dynamic) TempD ata Across requests No Preserved for 1 redirect only What interviewers expect A clear definition ti…
Answer: Automatically maps form values, query strings, route data to C# model properties. public IActionResult Submit(User user) { ... } Binds complex types and simple types out-of-the-box. What interviewers expect A cle…
Answer: Decorate model properties: public class User { [Required] [EmailAddress] public string Email { get; set; } } Automatically validated during model binding. Use ModelState.IsValid to check. What interviewers expect…
Answer: IValidatableObject: public IEnumerable&lt;ValidationResult&gt; Validate(ValidationContext context) Custom Attribute: public class MyCustomAttribute : ValidationAttribute { public override bool IsValid(obj…
Layouts: Shared structure (e.g. header, footer) using _Layout.cshtml. Partial Views: Reusable UI snippets (_LoginPartial.cshtml). View Components: Partial views with logic. public class CartViewComponent : ViewComponent…
Answer: Via ViewBag / ViewData / Model: return View(model); // Strongly typed ViewBag.Message = "Hello"; ViewData["Count"] = 5; What interviewers expect A clear definition tied to ASP.NET Core in ASP.NET Core projects Tr…
Answer: ActionFilter: Runs before/after action method. ResultFilter: Runs before/after view result. ExceptionFilter: Catches unhandled exceptions. Apply globally or via attributes. public class LogActionFilter : IActionF…
Answer: Razor Pages use handler methods: public class IndexModel : PageModel { public void OnGet() { ... } public IActionResult OnPost() { ... } } You can use asp-page-handler="Update" for custom methods. What interviewe…
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: IConfiguration is automatically registered and injected via constructor. public MyService(IConfiguration config) { var key = config["MyKey"]; }
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
dd custom validation and authorization filters using .AddEndpointFilter().
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
SP.NET Core provides structured logging via ILogger<T>.
public class MyService
{
private readonly ILogger<MyService> _logger;
public MyService(ILogger<MyService> logger) => _logger = logger;
public void DoSomething() => _logger.LogInformation("Action
performed");
}ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Yes—result filters can wrap or modify responses.
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: Occurs when two services depend on each other directly or indirectly. 🛠 Fix: Refactor to remove circular reference Use Lazy<T> or factory injection Split responsibilities
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
filter that tracks performance of controller actions:
public class ProfilingFilter : IAsyncActionFilter
{
public async Task OnActionExecutionAsync(
ctionExecutingContext context, ActionExecutionDelegate
next)
{
var sw = Stopwatch.StartNew();
var result = await next();
sw.Stop();
Console.WriteLine($"Action took
{sw.ElapsedMilliseconds}ms");
}
}ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Use a mocking framework like Moq:
var mockService = new Mock<IMyService>();
mockService.Setup(s => s.Get()).Returns("test");
var controller = new MyController(mockService.Object);
Mocking helps isolate the unit of work and test behavior independently.
MVC & Razor Pages
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
How does it differ from MVC in
“older” ASP.NET?
🔹 Key differences in ASP.NET Core:
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
SP.NET Core 2.0.
controller combined).
✅ Use Razor Pages for:
✅ Use MVC for:
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
When to use Razor Pages instead of
MVC?
ASP.NET Core 2.0.
controller combined).
✅ Use Razor Pages for:
✅ Use MVC for:
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Example:
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
/Pages/Products/Edit.cshtml.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: }"); Razor Pages Routing: Based on folder structure. URL /Products/Edit maps to /Pages/Products/Edit.cshtml.
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: view or JSON). View: .cshtml file that renders HTML. View Component: Reusable mini-views with logic (like partials but with code-behind).
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
a view or JSON).
with code-behind).
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Tag Helpers: Use HTML-like syntax. Easier to read/maintain.
<form asp-controller="Home" asp-action="Login"></form>
@Html.BeginForm("Login", "Home")
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
ta cross requests No Preserved for 1 redirect only
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: Purpose ViewDa Current request No Pass data to views ViewBa Current request Yes ViewData wrapper (dynamic) TempD ata Across requests No Preserved for 1 redirect only
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: Automatically maps form values, query strings, route data to C# model properties. public IActionResult Submit(User user) { ... } Binds complex types and simple types out-of-the-box.
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: Decorate model properties: public class User { [Required] [EmailAddress] public string Email { get; set; } } Automatically validated during model binding. Use ModelState.IsValid to check.
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: IValidatableObject: public IEnumerable<ValidationResult> Validate(ValidationContext context) Custom Attribute: public class MyCustomAttribute : ValidationAttribute { public override bool IsValid(object value) { ... } }
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
_Layout.cshtml.
public class CartViewComponent : ViewComponent {
public IViewComponentResult Invoke() => View("Cart",
model);
}ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: Via ViewBag / ViewData / Model: return View(model); // Strongly typed ViewBag.Message = "Hello"; ViewData["Count"] = 5;
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: ActionFilter: Runs before/after action method. ResultFilter: Runs before/after view result. ExceptionFilter: Catches unhandled exceptions. Apply globally or via attributes. public class LogActionFilter : IActionFilter { ... }
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: Razor Pages use handler methods: public class IndexModel : PageModel { public void OnGet() { ... } public IActionResult OnPost() { ... } } You can use asp-page-handler="Update" for custom methods.
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.