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 351–375 of 3281

Career & HR topics

By tech stack

Popular tracks

Mid PDF
How does configuration work in ASP.NET Core?

Short answer: ASP.NET Core configuration is flexible, layered, and environment-aware. Explain a bit more It reads settings from multiple sources (JSON files, environment variables, command-line rgs, etc.) and merges them…

Mid PDF
Configure JWT in Program.cs:?

Short answer: builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationS cheme) .AddJwtBearer(options => { options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuer = true, ValidateA…

Mid PDF
Configure middleware:?

Short answer: var app = builder.Build(); app.UseAuthentication(); app.UseAuthorization(); var app = builder.Build(); app.UseAuthentication(); app.UseAuthorization(); var app = builder.Build(); app.UseAuthentication(); ap…

Mid PDF
Enable proxies:?

Short answer: options.UseLazyLoadingProxies().UseSqlServer(...); options.UseLazyLoadingProxies().UseSqlServer(...); options.UseLazyLoadingProxies().UseSqlServer(...); options.UseLazyLoadingProxies().UseSqlServer(...); Re…

Mid PDF
Middleware vs Filters vs Handlers Concept When It Runs Scope Example Middleware Before/after request Global Logging, authentication Filters Around controller/action Controller/action Authorization, validation Handlers Authentication/Authorization Global or endpoint JWT handler, Cookie auth 1⃣

Short answer: Middleware vs Filters vs Handlers Concept When It Runs Scope Example Middleware Before/after request Global Logging, authentication Filters Around controller/action Controller/action Authorization, validati…

Mid PDF
Publish the app:?

Short answer: dotnet publish -c Release -o C:\inetpub\wwwroot\MyApp Real-world example (ShopNest) ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely. Say this i…

Mid PDF
Configure Redis in Program.cs:?

Short answer: builder.Services.AddStackExchangeRedisCache(options => { options.Configuration = "localhost:6379"; }); builder.Services.AddStackExchangeRedisCache(options => { options.Configuration = "…

Mid PDF
Access in code: builder.Configuration["ConnectionStrings:Default"]; ✅ Stored securely under your user profile (not in the project folder). 🌍 5. How do you use environment variables?

Short answer: Environment variables are great for overriding settings at deployment time (especially in Docker or Azure). Example: set ASPNETCORE_ENVIRONMENT=Production set ConnectionStrings__Default="Server=mydb;Da…

Mid PDF
Use [Authorize] on your API controllers:?

Short answer: [Authorize] [ApiController] [Route("api/[controller]")] public class OrdersController : ControllerBase { [HttpGet] public IActionResult GetOrders() => Ok("Secured Orders"); } [Authori…

Mid PDF
ApplicationUser class:?

Short answer: public class ApplicationUser : IdentityUser { public string FullName { get; set; } } public class ApplicationUser : IdentityUser { public string FullName { get; set; } } public class ApplicationUser : Ident…

Mid PDF
Use compiled queries for frequently executed queries.?

Short answer: Use compiled queries for frequently executed queries.? is a common interview topic in ASP.NET Core MVC. Give a clear definition, then one concrete example. Real-world example (ShopNest) ShopNest admin scree…

Mid PDF
Make navigation properties virtual:?

Short answer: public virtual Category Category { get; set; } public virtual Category Category { get; set; } public virtual Category Category { get; set; } public virtual Category Category { get; set; } public virtual Cat…

Mid PDF
SignalR vs WebSockets Feature WebSockets SignalR Protocol Low-level TCP-based High-level abstraction Transpor t Only WebSockets Fallbacks: WebSockets → SSE → Long Polling Usage Real-time messages Real-time hubs with automatic reconnection, grouping, scaling ✅ Use SignalR for apps needing broadcast, connection management, and fallbacks.

Short answer: SignalR vs WebSockets Feature WebSockets SignalR Protocol Low-level TCP-based High-level abstraction Transpor Only WebSockets Fallbacks: WebSockets → SSE → Long Polling Usage Real-time messages Real-time hu…

Mid PDF
How to Host in Azure App Service?

Short answer: How to Host in Azure App Service? Answer: Azure App Service provides PaaS hosting for ASP.NET Core apps. Steps: Publish the app via Visual Studio, CLI, or GitHub Actions. dotnet publish -c Release Create Ap…

Mid PDF
Health Checks – Endpoint /health for app readiness builder.Services.AddHealthChecks();?

Short answer: pp.MapHealthChecks("/health"); pp.MapHealthChecks("/health"); pp.MapHealthChecks("/health"); pp.MapHealthChecks("/health"); pp.MapHealthChecks("/health"); p…

Mid PDF
Now, only requests with a valid JWT in the Authorization: Bearer <token> header can access it. 󰰣 6. Explain role-based authorization.

Short answer: Role-based authorization restricts access based on user roles. ssign a role: wait _userManager.AddToRoleAsync(user, &quot;Admin&quot;); Use in controllers: [Authorize(Roles = &quot;Admin&quot;)] public IAct…

Mid PDF
DeveloperExceptionPage (for development) Example:?

Short answer: pp.UseExceptionHandler(&quot;/Home/Error&quot;); 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(&quot;/health&quot;); builder.Services.AddHealthChecks(); app.MapHealthChecks(&quot;/health&quot;); 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[&quot;APPINSIGHTS_INSTRUMENTATIONKEY&quot;]); 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…

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(&quot;_ProductListPartial&quot;, 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) =&gt; await Clients.All.SendAsync(&quot;ReceiveMessage&quot;, user, m…

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;)…

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

Short answer: ASP.NET Core configuration is flexible, layered, and environment-aware.

Explain a bit more

It reads settings from multiple sources (JSON files, environment variables, command-line rgs, etc.) and merges them into a single configuration object (IConfiguration).

Example code

In Program.cs: var builder = WebApplication.CreateBuilder(args); // Access configuration var appName = builder.Configuration["AppSettings:Name"]; SP.NET Core automatically loads:

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.AddAuthentication(JwtBearerDefaults.AuthenticationS cheme) .AddJwtBearer(options => { options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuer = true, ValidateAudience = true, ValidateLifetime = true, ValidateIssuerSigningKey = true, ValidIssuer = " ValidAudience = " IssuerSigningKey = new… SymmetricSecurityKey(……… Encoding.UTF8.GetBytes("super-secret-key-123")) }; });…

Explain a bit more

builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationS cheme) .AddJwtBearer(options => { options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuer = true, ValidateAudience = true, ValidateLifetime = true, ValidateIssuerSigningKey = true, ValidIssuer = " ValidAudience = " IssuerSigningKey = new SymmetricSecurityKey( Encoding.UTF8.GetBytes("super-secret-key-123")) }; }); builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationS cheme) .AddJwtBearer(options => { options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuer = true, ValidateAudience = true,…

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: var app = builder.Build(); app.UseAuthentication(); app.UseAuthorization(); var app = builder.Build(); app.UseAuthentication(); app.UseAuthorization(); var app = builder.Build(); app.UseAuthentication(); app.UseAuthorization(); var app = builder.Build(); app.UseAuthentication(); app.UseAuthorization(); var app = builder.Build(); app.UseAuthentication(); app.UseAuthorization(); var app = builder.Build();…

Explain a bit more

app.UseAuthentication(); app.UseAuthorization(); var app = builder.Build(); app.UseAuthentication(); app.UseAuthorization(); var app = builder.Build(); app.UseAuthentication(); app.UseAuthorization();

Example code

var app = builder.Build(); app.UseAuthentication(); app.UseAuthorization(); var app = builder.Build(); app.UseAuthentication(); app.UseAuthorization(); var app = builder.Build(); app.UseAuthentication(); app.UseAuthorization(); var app = builder.Build(); app.UseAuthentication(); app.UseAuthorization(); var app = builder.Build(); app.UseAuthentication(); app.UseAuthorization(); var app = builder.Build(); app.UseAuthentication(); app.UseAuthorization(); var app = builder.Build(); app.UseAuthentication(); app.UseAuthorization(); var app = builder.Build(); app.UseAuthentication(); app.UseAuthorization();

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: options.UseLazyLoadingProxies().UseSqlServer(...); options.UseLazyLoadingProxies().UseSqlServer(...); options.UseLazyLoadingProxies().UseSqlServer(...); options.UseLazyLoadingProxies().UseSqlServer(...);

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: Middleware vs Filters vs Handlers Concept When It Runs Scope Example Middleware Before/after request Global Logging, authentication Filters Around controller/action Controller/action Authorization, validation Handlers Authentication/Authorization Global or endpoint JWT handler, Cookie auth 1⃣

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: dotnet publish -c Release -o C:\inetpub\wwwroot\MyApp

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.AddStackExchangeRedisCache(options => { options.Configuration = "localhost:6379"; }); builder.Services.AddStackExchangeRedisCache(options => { options.Configuration = "localhost:6379"; }); builder.Services.AddStackExchangeRedisCache(options => { options.Configuration = "localhost:6379"; });… builder.Services.AddStackExchangeRedisCache(options => { options.Configuration = "localhost:6379"; });

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: Environment variables are great for overriding settings at deployment time (especially in Docker or Azure). Example: set ASPNETCORE_ENVIRONMENT=Production set ConnectionStrings__Default="Server=mydb;Database=App;User=sa;Passwor d=123" Notice the double underscores __ for nested keys. {

Example code

private readonly IWebHostEnvironment _env;
public HomeController(IWebHostEnvironment env)
{
_env = env;
}
public IActionResult Index()
{
if (_env.IsDevelopment())
return Content("Running in Development mode");
return Content($"Environment: {_env.EnvironmentName}");
}
} You can also access it in Program.cs: if (builder.Environment.IsProduction())
{ // Configure production services } 🧾 8. How to use different appsettings.json files? ASP.NET Core supports environment-specific JSON files. Example structure: ppsettings.json ppsettings.Development.json ppsettings.Staging.json ppsettings.Production.json Program.cs: builder.Configuration .AddJsonFile("appsettings.json") .AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.jso n", optional: true); t runtime, only the file matching the current environment will override base settings. Example: ppsettings.json { "AppName": "MyApp", "LogLevel": "Information" } ppsettings.Production.json { "LogLevel": "Error" } Result in Production → LogLevel = Error. 🔄 9. How to reload configuration dynamically? You can make JSON configuration files auto-reload when changed. Example: builder.Configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true); If you update appsettings.json, the new values are reflected automatically in your app without restarting. You can subscribe to changes using IOptionsMonitor (see below). 📦 10. How to bind configuration to POCO classes? You can map sections of your configuration directly to C# classes (POCOs). Example: ppsettings.json { "AppSettings": { "SiteName": "TechStore", "PageSize": 20, "EnableCache": true }
} Create a POCO: public class AppSettings
{
public string SiteName { get; set; }
public int PageSize { get; set; }
public bool EnableCache { get; set; }
} Bind configuration: builder.Services.Configure<AppSettings>( builder.Configuration.GetSection("AppSettings")); Inject it into a controller: public class HomeController : Controller
{
private readonly AppSettings _settings;
public HomeController(IOptions<AppSettings> options)
{
_settings = options.Value;
}
public IActionResult Index()
{
return Content($"Welcome to {_settings.SiteName}!");
}
} You can also use IOptionsSnapshot for per-request reload or IOptionsMonitor for live updates. Web APIs & REST

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: [Authorize] [ApiController] [Route("api/[controller]")] public class OrdersController : ControllerBase { [HttpGet] public IActionResult GetOrders() => Ok("Secured Orders"); } [Authorize] [ApiController] [Route("api/[controller]")] public class OrdersController : ControllerBase { [HttpGet] public IActionResult GetOrders() =>… Ok("Secured Orders"); }… [Authorize] [ApiController] [Route("api/[controller]")] public…

Explain a bit more

class OrdersController : ControllerBase { [HttpGet] public IActionResult GetOrders() => Ok("Secured Orders"); } [Authorize] [ApiController] [Route("api/[controller]")] public class OrdersController : ControllerBase { [HttpGet] public IActionResult GetOrders() =>… Ok("Secured Orders"); }

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 ApplicationUser : IdentityUser { public string FullName { get; set; } } public class ApplicationUser : IdentityUser { public string FullName { get; set; } } public class ApplicationUser : IdentityUser { public string FullName { get; set; } } public class ApplicationUser : IdentityUser { public string FullName { get; set; } } public class ApplicationUser : IdentityUser { public string FullName { get;…

Explain a bit more

set; } } public class ApplicationUser : IdentityUser { public string FullName { get; set; } } public class ApplicationUser : IdentityUser { public string FullName { get; set; } } public class ApplicationUser : IdentityUser { public string FullName { get; set; } }

Example code

public class ApplicationUser : IdentityUser { public string FullName { get; set; } } public class ApplicationUser : IdentityUser { public string FullName { get; set; } } public class ApplicationUser : IdentityUser { public string FullName { get; set; } } public class ApplicationUser : IdentityUser { public string FullName { get; set; } } public class ApplicationUser : IdentityUser { public string FullName { get; set; } } public class ApplicationUser : IdentityUser { public string FullName { get; set; } } public class ApplicationUser : IdentityUser { public string FullName { get; set; } } public class ApplicationUser : IdentityUser { public string FullName { get; set; } }

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: Use compiled queries for frequently executed queries.? is a common interview topic in ASP.NET Core MVC. Give a clear definition, then one concrete example.

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 virtual Category Category { get; set; } public virtual Category Category { get; set; } public virtual Category Category { get; set; } public virtual Category Category { get; set; } public virtual Category Category { get; set; } public virtual Category Category { get; set; } public virtual Category Category { get; set; } public virtual Category Category { get; set; }

Example code

public virtual Category Category { get; set; } public virtual Category Category { get; set; } public virtual Category Category { get; set; } public virtual Category Category { get; set; } public virtual Category Category { get; set; } public virtual Category Category { get; set; } public virtual Category Category { get; set; } public virtual Category Category { get; set; }

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: SignalR vs WebSockets Feature WebSockets SignalR Protocol Low-level TCP-based High-level abstraction Transpor Only WebSockets Fallbacks: WebSockets → SSE → Long Polling Usage Real-time messages Real-time hubs with automatic reconnection, grouping, scaling ✅ Use SignalR for apps needing broadcast, connection management, and fallbacks.

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 Host in Azure App Service? Answer: Azure App Service provides PaaS hosting for ASP.NET Core apps. Steps: Publish the app via Visual Studio, CLI, or GitHub Actions. dotnet publish -c Release Create App Service in Azure portal. Deploy using FTP, Git, or CI/CD pipelines. App Service automatically configures Kestrel + reverse proxy. ✅ Supports scaling, HTTPS, and monitoring out-of-the-box.

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: pp.MapHealthChecks("/health"); pp.MapHealthChecks("/health"); pp.MapHealthChecks("/health"); pp.MapHealthChecks("/health"); pp.MapHealthChecks("/health"); pp.MapHealthChecks("/health"); pp.MapHealthChecks("/health"); pp.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: Role-based authorization restricts access based on user roles. ssign a role: wait _userManager.AddToRoleAsync(user, "Admin"); Use in controllers: [Authorize(Roles = "Admin")] public IActionResult Dashboard() => View(); You can also combine roles: [Authorize(Roles = "Admin,Manager")] 🧭 7. {

Example code

public int Age { get; }
public MinimumAgeRequirement(int age) => Age = age;
}
public class MinimumAgeHandler : uthorizationHandler<MinimumAgeRequirement> { protected override Task HandleRequirementAsync( uthorizationHandlerContext context, MinimumAgeRequirement requirement) {
var birthDateClaim = context.User.FindFirst(c => c.Type == "BirthDate"); if (birthDateClaim != null)
{
var birthDate = DateTime.Parse(birthDateClaim.Value);
if (birthDate.AddYears(requirement.Age) <= DateTime.Today) context.Succeed(requirement); }
return Task.CompletedTask;
}
} Register it: builder.Services.AddAuthorization(options => { options.AddPolicy("AdultOnly", policy => policy.Requirements.Add(new MinimumAgeRequirement(18))); }); builder.Services.AddSingleton<IAuthorizationHandler, MinimumAgeHandler>(); Use it: [Authorize(Policy = "AdultOnly")] public IActionResult BuyAlcohol() => Ok("Access granted"); 🍪 9. What is cookie authentication in ASP.NET Core? Cookie authentication stores user information in an encrypted cookie on the browser. When the user revisits, the cookie is used to identify them. Configure: builder.Services.AddAuthentication(CookieAuthenticationDefaults.Auth enticationScheme) .AddCookie(options => {
options.LoginPath = "/Account/Login";

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: 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: 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: 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
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