Interview Q&A

Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.

4608 total questions 4508 technical 100 career & HR 4272 from PDF library

Showing 551–575 of 4608

Career & HR topics

By tech stack

Popular tracks

Mid PDF
DeveloperExceptionPage (for development) Example:?

Short answer: pp.UseExceptionHandler("/Home/Error"); or public class GlobalExceptionFilter : IExceptionFilter { public void OnException(ExceptionContext context) { context.Result = new ViewResult { ViewName = &…

Mid PDF
Health Checks – Endpoint /health for app readiness?

Short answer: builder.Services.AddHealthChecks(); app.MapHealthChecks("/health"); builder.Services.AddHealthChecks(); app.MapHealthChecks("/health"); builder.Services.AddHealthChecks(); app.MapHealthC…

Mid PDF
Configure in Program.cs: builder.Logging.ClearProviders(); builder.Logging.SetMinimumLevel(LogLevel.Information); builder.Host.UseNLog(); ✅ Both support structured logging, sinks, filtering, and rolling files. 8⃣ How to Enable Application Insights?

Short answer: Application Insights provides monitoring, telemetry, and tracing. Setup: builder.Services.AddApplicationInsightsTelemetry(builder.Configurati on["APPINSIGHTS_INSTRUMENTATIONKEY"]); Features: Track…

Mid PDF
Run tests. Example: (covered earlier in Mock DbContext) ✅ Fast, reliable for unit or light integration tests, but not suitable for relational behaviors (like joins, transactions). 🔟 How Do You Implement TestContainers for Integration Testing?

Short answer: TestContainers spins up real Docker containers (SQL Server, Redis) for integration testing, simulating production. Explain a bit more using Testcontainers.MsSql; var sqlContainer = new MsSqlBuilder() .WithP…

Junior PDF
This integrates Identity with EF Core using the AspNetUsers, AspNetRoles, etc. tables. 🧾 3. What is claims-based authentication? Follow :

Short answer: Claims-based authentication is based on claims — pieces of information about the user (like email, role, or permissions). Explain a bit more Each user has a collection of claims represented as key-value pai…

Mid PDF
DeveloperExceptionPage (for development) Example: app.UseExceptionHandler("/Home/Error"); or public class GlobalExceptionFilter : IExceptionFilter { public void OnException(ExceptionContext context) { context.Result = new ViewResult { ViewName = "Error" }; } } 🧩 19. How to return partial views?

Short answer: Partial views are used to render reusable page sections (like headers, sidebars). public IActionResult ProductList() var products = _service.GetAll(); return PartialView("_ProductListPartial", pro…

Mid PDF
Using SignalR for Real-Time Communication // Hub public class ChatHub : Hub { public async Task SendMessage(string user, string message) => await Clients.All.SendAsync("ReceiveMessage", user, message); } // Client (JavaScript) const connection = new signalR.HubConnectionBuilder() .withUrl("/chathub") .build(); connection.on("ReceiveMessage", (user, message) => { console.log(`${user}: ${message}`); }); await connection.start(); await connection.invoke("SendMessage", "Alice", "Hello!");

Short answer: Using SignalR for Real-Time Communication // Hub public class ChatHub : Hub { public async Task SendMessage(string user, string message) => await Clients.All.SendAsync("ReceiveMessage", user, m…

Senior PDF
Use it through IDistributedCache (as shown above). ✅ Redis supports features like eviction, expiration, pub/sub, and persistence. 📦 5. How to use Response Caching Middleware?

Short answer: Response caching caches the entire HTTP response at the server level — useful for static or rarely changing API responses. Explain a bit more Setup: builder.Services.AddResponseCaching(); var app = builder.…

Mid PDF
Alerts – Email/SMS/Slack for failures or slow responses ✅ Helps detect issues before users notice. 🧠 Summary Table Topic Tool / Feature Notes IIS Deployment ASP.NET Core Hosting Bundle IIS acts as reverse proxy Docker Deployment Dockerfile Build + runtime stages

Short answer: zure App Service PaaS Easy scaling, HTTPS CI/CD GitHub Actions / Azure DevOps Automated build/test/deploy Logging ILogger, Serilog, NLog Use structured logging Monitoring Application Insights, Prometheus Tr…

Mid PDF
Configure web.config (generated automatically) to forward requests to Kestrel. web.config Example: <aspNetCore processPath="dotnet" arguments=".\MyApp.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" /> ✅ IIS acts as a reverse proxy, Kestrel handles HTTP requests. 2⃣ How to Deploy to Docker?

Short answer: Docker allows running ASP.NET Core apps in containers, portable across environments. Dockerfile Example: # Build stage FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /app COPY *.csproj ./ RUN dotnet…

Mid PDF
Exception (special case — when an error occurs) Tip: Filters with a lower Order value run first. Example: [MyActionFilter(Order = 1)] [MyLoggingFilter(Order = 2)] ⚒ 14. How do you create a custom action filter?

Short answer: public class LogActionFilter : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext context) { Console.WriteLine($&quot;Action: {context.ActionDescriptor.DisplayName}&quot;)…

Mid PDF
Configure web.config (generated automatically) to forward requests to Kestrel. web.config Example: <aspNetCore processPath="dotnet" arguments=".\MyApp.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" /> ✅ IIS acts as a reverse proxy, Kestrel handles HTTP requests. Follow : 2⃣ How to Deploy to Docker?

Short answer: Docker allows running ASP.NET Core apps in containers, portable across environments. Dockerfile Example: # Build stage FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /app COPY *.csproj ./ RUN dotnet…

Mid PDF
User secrets (in Development) These are merged in order — later values override earlier ones. 🧱 2. What are configuration providers?

Short answer: Configuration providers are components that load configuration data from various sources. Explain a bit more Built-in Providers: JSON files (appsettings.json) Environment variables Command-line arguments In…

Mid PDF
Exception (special case — when an error occurs) Tip: Filters with a lower Order value run first. Example: Follow : [MyActionFilter(Order = 1)] [MyLoggingFilter(Order = 2)] ⚒ 14. How do you create a custom action filter?

Short answer: public class LogActionFilter : ActionFilterAttribute public override void OnActionExecuting(ActionExecutingContext context) Console.WriteLine($&quot;Action: {context.ActionDescriptor.DisplayName}&quot;); Us…

Mid PDF
Hangfire or Quartz.NET for Background Jobs Hangfire Example: app.UseHangfireDashboard(); RecurringJob.AddOrUpdate(() => Console.WriteLine("Recurring job"), Cron.Daily); Quartz.NET: Supports cron-like scheduling and clustered execution.

Short answer: Hangfire or Quartz.NET for Background Jobs Hangfire Example code app.UseHangfireDashboard(); RecurringJob.AddOrUpdate(() =&gt; Console.WriteLine(&quot;Recurring job&quot;), Cron.Daily); Quartz.NET: Supports…

Mid PDF
How to Test Minimal APIs?

Short answer: How to Test Minimal APIs? Answer: Minimal APIs are tested using WebApplicationFactory or TestServer. Example: var factory = new WebApplicationFactory&lt;Program&gt;(); Example code var client = factory.Crea…

Mid PDF
Health Checking in ASP.NET Core builder.Services.AddHealthChecks() .AddSqlServer(connectionString) .AddCheck<CustomHealthCheck>("CustomCheck"); app.MapHealthChecks("/health"); Custom Health Check Example: public class CustomHealthCheck : IHealthCheck { public Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken token) => Task.FromResult(HealthCheckResult.Healthy("Everything OK")); }

Short answer: Health Checking in ASP.NET Core builder.Services.AddHealthChecks() .AddSqlServer(connectionString) .AddCheck&lt;CustomHealthCheck&gt;(&quot;CustomCheck&quot;); app.MapHealthChecks(&quot;/health&quot;); Cust…

Mid PDF
How to Use Serilog or NLog?

Short answer: How to Use Serilog or NLog? Serilog Example (Program.cs): builder.Host.UseSerilog((ctx, lc) =&gt; lc .WriteTo.Console() .WriteTo.File(&quot;logs/log-.txt&quot;, rollingInterval: RollingInterval.Day) ); NLog…

Mid PDF
What Frameworks Are Commonly Used?

Short answer: What Frameworks Are Commonly Used? Answer: xUnit – Popular, lightweight, supports parallel testing. NUnit – Rich assertion library. MSTest – Microsoft-supported, integrated in Visual Studio. Most modern ASP…

Junior PDF
Deploy self-contained trimmed builds for smaller binaries. Example for build optimization: dotnet publish -c Release /p:PublishTrimmed=true /p:ReadyToRun=true 🔐 10. What is Data Protection in ASP.NET Core?

Short answer: ASP.NET Core Data Protection API provides secure cryptographic APIs for: Encrypting cookies and tokens Protecting form data Persisting secure keys (across app restarts) Setup: builder.Services.AddDataProtec…

Junior PDF
Deploy self-contained trimmed builds for smaller binaries. Example for build optimization: dotnet publish -c Release /p:PublishTrimmed=true /p:ReadyToRun=true 🔐 10. What is Data Protection in ASP.NET Core? Follow :

Short answer: ASP.NET Core Data Protection API provides secure cryptographic APIs for: Encrypting cookies and tokens Protecting form data Persisting secure keys (across app restarts) Setup: builder.Services.AddDataProtec…

Mid PDF
Profile queries with ToQueryString(). Example: var data = _context.Products.AsNoTracking().Select(p => new { p.Name, p.Price }).ToList(); ⚡ 18. How to use compiled queries?

Short answer: Compiled queries improve performance by caching query translation. Example code private static readonly Func&lt;AppDbContext, decimal, IEnumerable&lt;Product&gt;&gt; _getExpensiveProducts = EF.CompileQuery(…

Mid PDF
Rate Limiting Middleware in .NET 8 builder.Services.AddRateLimiter(options => { options.GlobalLimiter = PartitionedRateLimiter.Create<HttpContext, string>(httpContext => RateLimitPartition.GetFixedWindowLimiter(httpContext.Connection.Remo teIpAddress?

Short answer: Rate Limiting Middleware in .NET 8 builder.Services.AddRateLimiter(options =&gt; { options.GlobalLimiter = PartitionedRateLimiter.Create&lt;HttpContext, string&gt;(httpContext =&gt; RateLimitPartition.GetFi…

Mid PDF
How to Enable Application Insights?

Short answer: How to Enable Application Insights? Answer: Application Insights provides monitoring, telemetry, and tracing. Setup: builder.Services.AddApplicationInsightsTelemetry(builder.Configurati on[&quot;APPINSIGHTS…

Mid PDF
How to Use Moq for Mocking Dependencies?

Short answer: How to Use Moq for Mocking Dependencies? Answer: Moq creates fake implementations of interfaces to control behavior during tests. Example: var mockRepo = new Mock&lt;IProductRepository&gt;(); mockRepo.Setup…

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: pp.UseExceptionHandler("/Home/Error"); or public class GlobalExceptionFilter : IExceptionFilter { public void OnException(ExceptionContext context) { context.Result = new ViewResult { ViewName = "Error" }; } } 🧩 19.

Explain a bit more

pp.UseExceptionHandler("/Home/Error"); or public class GlobalExceptionFilter : IExceptionFilter { public void OnException(ExceptionContext context) { context.Result = new ViewResult { ViewName = "Error" }; } } 🧩 19. {

Example code

public void OnException(ExceptionContext context)
{
context.Result = new ViewResult { ViewName = "Error" };
}
} 🧩 19. How to return partial views? Partial views are used to render reusable page sections (like headers, sidebars). Example: public IActionResult ProductList()
{
var products = _service.GetAll();
return PartialView("_ProductListPartial", products);
} In Razor: @Html.Partial("_ProductListPartial", Model.Products) 🧾 20. Explain Razor Pages vs MVC. Feature Razor Pages MVC Structure Page-based (.cshtml + .cshtml.cs) Controller + View Best For Simple or CRUD pages Complex or large web apps URL /Products/Edit → /Pages/Products/Edit.cshtml /Products/Edit → ProductController.Edit() Code Location In the same file (PageModel) Separate Controller class Example: Razor Pages are like simplified MVC without controllers — great for admin dashboards or forms. Dependency Injection (DI)

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: builder.Services.AddHealthChecks(); app.MapHealthChecks("/health"); builder.Services.AddHealthChecks(); app.MapHealthChecks("/health"); builder.Services.AddHealthChecks(); app.MapHealthChecks("/health"); builder.Services.AddHealthChecks(); app.MapHealthChecks("/health");

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: Application Insights provides monitoring, telemetry, and tracing. Setup: builder.Services.AddApplicationInsightsTelemetry(builder.Configurati on["APPINSIGHTS_INSTRUMENTATIONKEY"]); Features: Track requests, exceptions, and dependencies Live metrics and dashboards Custom events and telemetry 9⃣ How to Monitor Performance and Uptime?

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: TestContainers spins up real Docker containers (SQL Server, Redis) for integration testing, simulating production.

Explain a bit more

using Testcontainers.MsSql; var sqlContainer = new MsSqlBuilder() .WithPassword("yourStrong(!)Password") .Build(); wait sqlContainer.StartAsync(); var options = new DbContextOptionsBuilder<AppDbContext>() .UseSqlServer(sqlContainer.GetConnectionString()) .Options; // Use context in tests ✅ Benefits: Real database behavior CI/CD friendly Close to production setup Deployment & Hosting How to Deploy an ASP.NET Core App to IIS? TestContainers spins up real Docker containers (SQL Server, Redis) for integration testing, simulating production.

Example code

using Testcontainers.MsSql; var sqlContainer = new MsSqlBuilder() .WithPassword("yourStrong(!)Password") .Build(); wait sqlContainer.StartAsync(); var options = new DbContextOptionsBuilder<AppDbContext>() .UseSqlServer(sqlContainer.GetConnectionString()) .Options; // Use context in tests ✅ Benefits: Real database behavior CI/CD friendly Close to production setup Deployment & Hosting How to Deploy an ASP.NET Core App to IIS? TestContainers spins up real Docker containers (SQL Server, Redis) for integration testing, simulating production. Example: using Testcontainers.MsSql; var sqlContainer = new MsSqlBuilder() .WithPassword("yourStrong(!)Password") .Build(); wait sqlContainer.StartAsync(); var options = new DbContextOptionsBuilder<AppDbContext>() .UseSqlServer(sqlContainer.GetConnectionString()) .Options; // Use context in tests ✅ Benefits: Real database behavior CI/CD friendly Close to production setup Deployment & Hosting How to Deploy an ASP.NET Core App to IIS? IIS (Internet Information Services) can host ASP.NET Core apps via the ASP.NET Core Module, which forwards requests to Kestrel. Steps: TestContainers spins up real Docker containers (SQL Server, Redis) for integration testing, simulating production. Example: using Testcontainers.MsSql; var sqlContainer = new MsSqlBuilder() .WithPassword("yourStrong(!)Password") .Build(); wait sqlContainer.StartAsync(); var options = new DbContextOptionsBuilder<AppDbContext>() .UseSqlServer(sqlContainer.GetConnectionString()) .Options; // Use context in tests ✅ Benefits: Real database behavior CI/CD friendly Close to production setup Deployment & Hosting How to Deploy an ASP.NET Core App to IIS? IIS (Internet Information Services) can host ASP.NET Core apps via the ASP.NET Core Module, which forwards requests to Kestrel. Steps:

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: Claims-based authentication is based on claims — pieces of information about the user (like email, role, or permissions).

Explain a bit more

Each user has a collection of claims represented as key-value pairs.

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: Partial views are used to render reusable page sections (like headers, sidebars). public IActionResult ProductList() var products = _service.GetAll(); return PartialView("_ProductListPartial", products); In Razor: Follow : @Html.Partial("_ProductListPartial", Model.Products) 🧾 20. Partial views are used to render reusable page sections (like headers, sidebars).

Example code

public IActionResult ProductList() var products = _service.GetAll(); return PartialView("_ProductListPartial", products); In Razor: Follow : @Html.Partial("_ProductListPartial", Model.Products) 🧾 20. Partial views are used to render reusable page sections (like headers, sidebars). Example: public IActionResult ProductList() var products = _service.GetAll(); return PartialView("_ProductListPartial", products); In Razor: Follow : @Html.Partial("_ProductListPartial", Model.Products) 🧾 20. Explain Razor Pages vs MVC. Feature Razor Pages MVC Structure Page-based (.cshtml + .cshtml.cs) Controller + View Best For Simple or CRUD pages Complex or large web apps URL /Products/Edit → /Pages/Products/Edit.cshtml /Products/Edit → ProductController.Edit() Code Location In the same file (PageModel) Separate Controller class Example: Razor Pages are like simplified MVC without controllers — great for admin dashboards or forms. Dependency Injection (DI) Partial views are used to render reusable page sections (like headers, sidebars). Example: public IActionResult ProductList() var products = _service.GetAll(); return PartialView("_ProductListPartial", products); In Razor: Follow : @Html.Partial("_ProductListPartial", Model.Products) 🧾 20. Explain Razor Pages vs MVC. Feature Razor Pages MVC Structure Page-based (.cshtml + .cshtml.cs) Controller + View Best For Simple or CRUD pages Complex or large web apps URL /Products/Edit → /Pages/Products/Edit.cshtml /Products/Edit → ProductController.Edit() Code Location In the same file (PageModel) Separate Controller class Example: Razor Pages are like simplified MVC without controllers — great for admin dashboards or forms. Dependency Injection (DI)

Real-world example (ShopNest)

ShopNest’s product edit form posts to an MVC action. Model binding fills a ProductEditVm; the action validates and redisplay the view on errors.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: Using SignalR for Real-Time Communication // Hub public class ChatHub : Hub { public async Task SendMessage(string user, string message) => await Clients.All.SendAsync("ReceiveMessage", user, message); } // Client (JavaScript) const connection = new signalR.HubConnectionBuilder() .withUrl("/chathub") .build(); connection.on("ReceiveMessage", (user, message) => { console.log(`${user}: ${message}`); }); await…

Explain a bit more

connection.start(); await connection.invoke("SendMessage", "Alice", "Hello!");

Example code

Using SignalR for Real-Time Communication // Hub public class ChatHub : Hub
{
public async Task SendMessage(string user, string message) =>
await Clients.All.SendAsync("ReceiveMessage", user, message); } // Client (JavaScript) const connection = new signalR.HubConnectionBuilder() .withUrl("/chathub") .build(); connection.on("ReceiveMessage", (user, message) => { console.log(`${user}: ${message}`); }); await connection.start();
await connection.invoke("SendMessage", "Alice", "Hello!");

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: Response caching caches the entire HTTP response at the server level — useful for static or rarely changing API responses.

Explain a bit more

Setup: builder.Services.AddResponseCaching(); var app = builder.Build(); pp.UseResponseCaching(); Controller Example: [ResponseCache(Duration = 60, Location = ResponseCacheLocation.Any)] [HttpGet] public IActionResult GetTime() => Ok(DateTime.Now); ✅ The response is cached for 60 seconds — subsequent requests are served faster. {

Example code

return Ok(new { Category = category, Time = DateTime.Now });
} ✅ Benefits: Works with authenticated users. Supports vary-by parameters, headers, and policies. Integrates well with minimal APIs and Razor pages. 🗜 7. How to compress responses? Use response compression middleware to reduce payload size for clients. Setup: builder.Services.AddResponseCompression(options => {
{
var data = await _service.GetDataAsync(); // Non-blocking call
return Ok(data);
} ✅ Benefits: Frees threads while waiting for I/O (e.g., DB, HTTP calls). Improves scalability and throughput. Essential for high-traffic APIs and cloud-native apps. ❌ Avoid Task.Result or .Wait() — they block threads and reduce performance. ⚡ 9. How to optimize startup performance? To improve startup and cold-boot performance: ✅ Tips:

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: zure App Service PaaS Easy scaling, HTTPS CI/CD GitHub Actions / Azure DevOps Automated build/test/deploy Logging ILogger, Serilog, NLog Use structured logging Monitoring Application Insights, Prometheus Track metrics, uptime Health Checks ASP.NET Core HealthChecks Expose /health endpoints This gives a complete production-ready workflow from… deployment… to…… monitoring.

Explain a bit more

zure App Service PaaS Easy scaling, HTTPS CI/CD GitHub Actions / Azure DevOps Automated build/test/deploy Logging ILogger, Serilog, NLog Use structured logging Monitoring Application Insights, Prometheus Track metrics, uptime Health Checks ASP.NET Core HealthChecks Expose /health endpoints This gives a complete production-ready workflow from deployment to… monitoring. dvanced & Modern Topics Middleware Pipeline in Depth ASP.NET Core handles HTTP requests through a middleware pipeline, which is a sequence of components where each can: Inspect or modify the request Call the next middleware Short-circuit the pipeline Pipeline Flow: Request -> Middleware1 -> Middleware2 ->…… {

Example code

public async Task SendMessage(string user, string message) => wait Clients.All.SendAsync("ReceiveMessage", user, message); } // Client (JavaScript) const connection = new signalR.HubConnectionBuilder() .withUrl("/chathub") .build(); connection.on("ReceiveMessage", (user, message) => { console.log(`${user}: ${message}`); }); wait connection.start(); wait connection.invoke("SendMessage", "Alice", "Hello!"); 5⃣ Background Services (IHostedService) For long-running tasks or scheduled jobs Implement IHostedService or extend BackgroundService public class TimedWorker : BackgroundService
{ protected override async Task ExecuteAsync(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { Console.WriteLine("Running background task"); wait Task.Delay(10000, stoppingToken); }
}
} builder.Services.AddHostedService<TimedWorker>(); ✅ Good for periodic jobs, email processing, queue consumers. 6⃣ Hangfire or Quartz.NET for Background Jobs Hangfire Example: pp.UseHangfireDashboard(); RecurringJob.AddOrUpdate(() => Console.WriteLine("Recurring job"), Cron.Daily); Quartz.NET: Supports cron-like scheduling and clustered execution. 7⃣ Health Checking in ASP.NET Core builder.Services.AddHealthChecks() .AddSqlServer(connectionString) .AddCheck<CustomHealthCheck>("CustomCheck"); pp.MapHealthChecks("/health"); Custom Health Check Example: public class CustomHealthCheck : IHealthCheck
{
public Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken token) => Task.FromResult(HealthCheckResult.Healthy("Everything OK")); } 8⃣ Rate Limiting Middleware in .NET 8 builder.Services.AddRateLimiter(options => { options.GlobalLimiter = PartitionedRateLimiter.Create<HttpContext, string>(httpContext => RateLimitPartition.GetFixedWindowLimiter(httpContext.Connection.Remo teIpAddress?.ToString()!, _ => new FixedWindowRateLimiterOptions { PermitLimit = 10, Window = TimeSpan.FromMinutes(1), QueueLimit = 2 })); }); pp.UseRateLimiter(); ✅ Helps protect APIs from abuse or DoS attacks. 9⃣ DataAnnotations for Validation public class Product
{ [Required] public string Name { get; set; } [Range(1, 100)] public decimal Price { get; set; }
} Works with model binding Automatic client & server-side validation with Razor or API endpoints 🔟 Global Exception Logging pp.UseExceptionHandler(errorApp => { errorApp.Run(async context => {

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: Docker allows running ASP.NET Core apps in containers, portable across environments. Dockerfile Example: # Build stage FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /app COPY *.csproj ./ RUN dotnet restore COPY .

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: public class LogActionFilter : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext context) { Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); } } Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15.

Explain a bit more

How do you pass data from controller to view?

Example code

public class LogActionFilter : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext context) { Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); } } Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15. How do you pass data from controller to view? public class LogActionFilter : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext context) { Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); } } Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15. How do you pass data from controller to view? public class LogActionFilter : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext context) { Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); } } Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15. How do you pass data from controller to view? public class LogActionFilter : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext context) { Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); } } Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15. How do you pass data from controller to view? You can use: public class LogActionFilter : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext context) { Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); }
} Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15. How do you pass data from controller to view? You can use:

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: Docker allows running ASP.NET Core apps in containers, portable across environments. Dockerfile Example: # Build stage FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /app COPY *.csproj ./ RUN dotnet restore COPY .

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: Configuration providers are components that load configuration data from various sources.

Explain a bit more

Built-in Providers: JSON files (appsettings.json) Environment variables Command-line arguments In-memory collections Azure Key Vault User Secrets (for local dev) Custom providers (you can build your own) builder.Configuration .AddJsonFile("appsettings.json") .AddEnvironmentVariables() .AddCommandLine(args); Each provider plugs into the same configuration system, so you can access everything via IConfiguration. Configuration providers are components that load configuration data from various sources. Built-in Providers: JSON files (appsettings.json) Environment variables Command-line arguments In-memory collections Azure Key Vault User Secrets (for local dev) Custom providers (you can build your own)

Example code

builder.Configuration .AddJsonFile("appsettings.json") .AddEnvironmentVariables() .AddCommandLine(args); Each provider plugs into the same configuration system, so you can access everything via IConfiguration. Configuration providers are components that load configuration data from various sources. Built-in Providers: JSON files (appsettings.json) Environment variables Command-line arguments In-memory collections Azure Key Vault User Secrets (for local dev) Custom providers (you can build your own) Example: builder.Configuration .AddJsonFile("appsettings.json") .AddEnvironmentVariables() .AddCommandLine(args); Each provider plugs into the same configuration system, so you can access everything via IConfiguration. Configuration providers are components that load configuration data from various sources. Built-in Providers: JSON files (appsettings.json) Environment variables Command-line arguments In-memory collections Azure Key Vault User Secrets (for local dev) Custom providers (you can build your own) Example: builder.Configuration .AddJsonFile("appsettings.json") .AddEnvironmentVariables() .AddCommandLine(args); Each provider plugs into the same configuration system, so you can access everything via IConfiguration. 🔐 3. How do you manage secrets in development? In development, never store passwords, API keys, or connection strings in code or ppsettings.json. Use User Secrets — a safe way to store secrets outside the project tree. 🧰 4. What is User Secrets in ASP.NET Core? User Secrets are a local, developer-only configuration storage that keeps sensitive data out of source control. Setup: Enable secrets: dotnet user-secrets init

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: public class LogActionFilter : ActionFilterAttribute public override void OnActionExecuting(ActionExecutingContext context) Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15.

Explain a bit more

How do you pass data from controller to view?

Example code

public class LogActionFilter : ActionFilterAttribute public override void OnActionExecuting(ActionExecutingContext context) Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15. How do you pass data from controller to view? public class LogActionFilter : ActionFilterAttribute public override void OnActionExecuting(ActionExecutingContext context) Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15. How do you pass data from controller to view? public class LogActionFilter : ActionFilterAttribute public override void OnActionExecuting(ActionExecutingContext context) Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15. How do you pass data from controller to view? You can use: public class LogActionFilter : ActionFilterAttribute public override void OnActionExecuting(ActionExecutingContext context) Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15. How do you pass data from controller to view? You can use: public class LogActionFilter : ActionFilterAttribute public override void OnActionExecuting(ActionExecutingContext context) Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15. How do you pass data from controller to view? public class LogActionFilter : ActionFilterAttribute public override void OnActionExecuting(ActionExecutingContext context) Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15. How do you pass data from controller to view? You can use: public class LogActionFilter : ActionFilterAttribute public override void OnActionExecuting(ActionExecutingContext context) Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15. How do you pass data from controller to view? You can use:

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: Hangfire or Quartz.NET for Background Jobs Hangfire

Example code

app.UseHangfireDashboard(); RecurringJob.AddOrUpdate(() => Console.WriteLine("Recurring job"), Cron.Daily); Quartz.NET: Supports cron-like scheduling and clustered execution.

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: How to Test Minimal APIs? Answer: Minimal APIs are tested using WebApplicationFactory or TestServer. Example: var factory = new WebApplicationFactory<Program>();

Example code

var client = factory.CreateClient();
var response = await client.GetAsync("/products");
var products = await response.Content.ReadFromJsonAsync<List<Product>>(); Assert.NotEmpty(products);

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: Health Checking in ASP.NET Core builder.Services.AddHealthChecks() .AddSqlServer(connectionString) .AddCheck<CustomHealthCheck>("CustomCheck"); app.MapHealthChecks("/health"); Custom Health Check Example: public class CustomHealthCheck : IHealthCheck

Example code

{
public Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken token) => Task.FromResult(HealthCheckResult.Healthy("Everything OK")); }

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: How to Use Serilog or NLog? Serilog Example (Program.cs): builder.Host.UseSerilog((ctx, lc) => lc .WriteTo.Console() .WriteTo.File("logs/log-.txt", rollingInterval: RollingInterval.Day) ); NLog

Example code

Install NLog.Extensions.Logging package Add NLog.config file Configure in Program.cs: builder.Logging.ClearProviders(); builder.Logging.SetMinimumLevel(LogLevel.Information); builder.Host.UseNLog(); ✅ Both support structured logging, sinks, filtering, and rolling files.

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: What Frameworks Are Commonly Used? Answer: xUnit – Popular, lightweight, supports parallel testing. NUnit – Rich assertion library. MSTest – Microsoft-supported, integrated in Visual Studio. Most modern ASP.NET Core projects use xUnit + Moq.

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: ASP.NET Core Data Protection API provides secure cryptographic APIs for: Encrypting cookies and tokens Protecting form data Persisting secure keys (across app restarts) Setup: builder.Services.AddDataProtection() .PersistKeysToFileSystem(new DirectoryInfo(@"c:\keys")) .SetApplicationName("MyApp"); You can use it directly: var protector =………… _provider.CreateProtector("MyPurpose"); var encrypted =…

Explain a bit more

protector.Protect("secret-data"); var decrypted = protector.Unprotect(encrypted); ✅ Data Protection is the backbone for: Cookie Authentication CSRF Tokens TempData encryption 🧠 Summary Concept Description Best For In-memory caching Stores data in server memory Single-server or dev Distributed caching Shared cache (Redis, SQL) Scalable apps Response caching Caches HTTP responses Public/static data Output caching (.NET 8) Advanced, user-aware caching Dynamic APIs Response compression Gzip/Brotli for responses Large payloads sync/await Non-blocking I/O High concurrency Startup optimization Faster app boot Cloud apps… ASP.NET Core Data…… var encrypted = protector.Protect("secret-data");

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: ASP.NET Core Data Protection API provides secure cryptographic APIs for: Encrypting cookies and tokens Protecting form data Persisting secure keys (across app restarts) Setup: builder.Services.AddDataProtection() .PersistKeysToFileSystem(new DirectoryInfo(@"c:\keys")) .SetApplicationName("MyApp"); You can use it directly: var protector =………… _provider.CreateProtector("MyPurpose"); var encrypted =…

Explain a bit more

protector.Protect("secret-data"); var decrypted = protector.Unprotect(encrypted); ✅ Data Protection is the backbone for: Cookie Authentication CSRF Tokens TempData encryption 🧠 Summary Concept Description Best For In-memory caching Stores data in server memory Single-server or dev Distributed caching Shared cache (Redis, SQL) Scalable apps Response caching Caches HTTP responses Public/static data Follow : Output caching (.NET 8) Advanced, user-aware caching Dynamic APIs Response compression Gzip/Brotli for responses Large payloads Async/await Non-blocking I/O High concurrency Startup optimization Faster app boot… ASP.NET Core Data……

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: Compiled queries improve performance by caching query translation.

Example code

private static readonly Func<AppDbContext, decimal, IEnumerable<Product>> _getExpensiveProducts = EF.CompileQuery((AppDbContext ctx, decimal price) => ctx.Products.Where(p => p.Price > price)); var result = _getExpensiveProducts(_context, 1000); 🔍 19. Pool Size=5; uthentication & Authorization

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: Rate Limiting Middleware in .NET 8 builder.Services.AddRateLimiter(options => { options.GlobalLimiter = PartitionedRateLimiter.Create<HttpContext, string>(httpContext => RateLimitPartition.GetFixedWindowLimiter(httpContext.Connection.Remo teIpAddress?.ToString()!, _ => new FixedWindowRateLimiterOptions { PermitLimit = 10, Window = TimeSpan.FromMinutes(1), QueueLimit = 2 })); }); app.UseRateLimiter(); ✅ Helps protect…

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: How to Enable Application Insights? Answer: Application Insights provides monitoring, telemetry, and tracing. Setup: builder.Services.AddApplicationInsightsTelemetry(builder.Configurati on["APPINSIGHTS_INSTRUMENTATIONKEY"]); Features: Track requests, exceptions, and dependencies Live metrics and dashboards Custom events and telemetry

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

ASP.NET Core MVC ASP.NET Core MVC Tutorial · MVC

Short answer: How to Use Moq for Mocking Dependencies? Answer: Moq creates fake implementations of interfaces to control behavior during tests. Example: var mockRepo = new Mock<IProductRepository>(); mockRepo.Setup(x => x.GetAll()).Returns(new List<Product> { new Product { Id = 1, Name = "Laptop" } });

Example code

var service = new ProductService(mockRepo.Object);
var products = service.GetAll(); Assert.Single(products); ✅ Use .Setup(), .Verify(), and .Returns() to simulate behavior.

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details