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 151–175 of 261

Career & HR topics

By tech stack

Mid PDF
Role of appsettings.json, appsettings.Development.json, etc. ● appsettings.json: Base configuration file used across all environments. ● appsettings.{Environment}.json: Environment-specific overrides (e.g., Development, Production). 🔧 ASP.NET Core loads them automatically based on the environment:

Short answer: SPNETCORE_ENVIRONMENT=Development ✅ Loaded in order of precedence, where later files override earlier ones. Real-world example (ShopNest) A ShopNest checkout request flows through middleware, hits a minimal…

ASP.NET Core Read answer
Mid PDF
Role of appsettings.json, appsettings.Development.json, etc.?

Short answer: appsettings.json: Base configuration file used across all environments. appsettings.{Environment}.json: Environment-specific overrides (e.g., Development, Production). 🔧 ASP.NET Core loads them automatical…

ASP.NET Core Read answer
Mid PDF
Environment-based configuration (Development, Staging, Production)?

Short answer: SP.NET Core uses the ASPNETCORE_ENVIRONMENT variable to determine the runtime environment. Supported environments (by convention): Development Staging Production Environment-specific logic can be applied: i…

ASP.NET Core Read answer
Mid PDF
Environment-based configuration (Development, Staging,?

Short answer: Production) ASP.NET Core uses the ASPNETCORE_ENVIRONMENT variable to determine the runtime environment. Supported environments (by convention): Development Staging Production Environment-specific logic can…

ASP.NET Core Read answer
Mid PDF
Overriding settings via environment variables, command line?

Short answer: ✅ ASP.NET Core supports hierarchical override of config sources: Environment variables override appsettings.json: MyApp__Logging__LogLevel__Default=Warning Command line arguments override everything: dotnet…

ASP.NET Core Read answer
Mid PDF
Using IConfiguration to read settings?

Short answer: Inject IConfiguration anywhere: public class MyService { Example code private readonly string _apiKey; public MyService(IConfiguration config) { _apiKey = config["MySettings:ApiKey"]; } } You can…

ASP.NET Core Read answer
Mid PDF
Binding configuration sections to POCOs?

Short answer: Bind config to strongly typed objects: public class MySettings { Example code public string ApiKey { get; set; } public int Timeout { get; set; } } services.Configure<MySettings>(config.GetSection(&qu…

ASP.NET Core Read answer
Mid PDF
Using Options pattern (IOptions<T>, IOptionsSnapshot<T>,?

Short answer: IOptionsMonitor&lt;T&gt;) IOptions&lt;T&gt;: Reads settings once at startup. IOptionsSnapshot&lt;T&gt;: Gets updated settings per request (for scoped services). IOptionsMonitor&lt;T&gt;: Supports change not…

ASP.NET Core Read answer
Mid PDF
Secret management (e.g. user secrets, Azure Key Vault)?

Short answer: User Secrets (for local dev): dotnet user-secrets init dotnet user-secrets set &quot;MySettings:ApiKey&quot; &quot;secret&quot; Azure Key Vault: builder.Configuration.AddAzureKeyVault(...); ✅ Secure sensiti…

ASP.NET Core Read answer
Mid PDF
Logging configuration: how to configure log levels?

Short answer: In appsettings.json: &quot;Logging&quot;: { &quot;LogLevel&quot;: { &quot;Default&quot;: &quot;Information&quot;, &quot;Microsoft&quot;: &quot;Warning&quot;, &quot;Microsoft.Hosting.Lifetime&quot;: &quot;In…

ASP.NET Core Read answer
Mid PDF
Connection strings management?

Short answer: Stored under &quot;ConnectionStrings&quot; section in appsettings.json: &quot;ConnectionStrings&quot;: { &quot;DefaultConnection&quot;: &quot;Server=.;Database=AppDb;Trusted_Connection=True;&quot; } Read vi…

ASP.NET Core Read answer
Mid PDF
Settings reloading (on change) if supported?

Short answer: JSON files support live reload: builder.Configuration.AddJsonFile(&quot;appsettings.json&quot;, optional: false, reloadOnChange: true); IOptionsMonitor&lt;T&gt; automatically updates bound values when confi…

ASP.NET Core Read answer
Mid PDF
Strongly typed configuration?

Short answer: Using POCOs and Options pattern allows type-safe config: services.Configure&lt;MySettings&gt;(config.GetSection(&quot;MySettings&quot;)); Use [Required], [Range], etc., to add validation. Real-world example…

ASP.NET Core Read answer
Mid PDF
Validating configuration (e.g., using IValidateOptions)?

Short answer: You can validate bound config using IValidateOptions&lt;T&gt;: public class MySettingsValidator : IValidateOptions&lt;MySettings&gt; { Example code public ValidateOptionsResult Validate(string name, MySetti…

ASP.NET Core Read answer
Mid PDF
Configuration providers (JSON, XML, INI, Environment, Azure, etc.)?

Short answer: ASP.NET Core supports multiple configuration providers: JSON (default) Environment Variables Command Line Args INI files XML files In-memory Azure App Configuration Azure Key Vault Secrets Manager Each can…

ASP.NET Core Read answer
Mid PDF
Default values and optional settings?

Short answer: Use default values in POCOs or fallback logic: public class MySettings { Example code public string ApiKey { get; set; } = &quot;default-api-key&quot;; } Or: var apiKey = config[&quot;MySettings:ApiKey&quot…

ASP.NET Core Read answer
Mid PDF
Default values and optional settings Use default values in POCOs or fallback logic: public class MySettings { public string ApiKey { get; set; } = "default-api-key"; } Or: var apiKey = config["MySettings:ApiKey"] ?

Short answer: Default values and optional settings Use default values in POCOs or fallback logic: public class MySettings { public string ApiKey { get; set; } = &quot;default-api-key&quot;; } Or: var apiKey = config[&quo…

ASP.NET Core Read answer
Mid PDF
Masking sensitive configuration data ✅ Best practices: ● Don't log sensitive values ● Use [JsonIgnore] or remove values before logging ● Mask in logs manually: _logger.LogInformation("Token: {Token}", Mask(token)); ● Never store secrets in source-controlled files (appsettings.json) ● Use user-secrets, Key Vault, or environment variables instead

Short answer: uthentication &amp;amp; Authorization (JWT, Identity) uthentication &amp;amp; Authorization (JWT, Identity) uthentication &amp;amp; Authorization (JWT, Identity) uthentication &amp;amp; Authorization (JWT,…

ASP.NET Core Read answer
Mid PDF
Masking sensitive configuration data?

Short answer: ✅ Best practices: Don't log sensitive values Use [JsonIgnore] or remove values before logging Mask in logs manually: _logger.LogInformation(&quot;Token: {Token}&quot;, Mask(token)); Never store secrets in s…

ASP.NET Core Read answer
Junior PDF
What is authentication vs authorization?

Short answer: ction (What are you allowed to do?) In ASP.NET Core, both are handled via middleware and attributes like [Authorize], roles, nd policies. Real-world example (ShopNest) A ShopNest checkout request flows thro…

ASP.NET Core Read answer
Junior PDF
What is authentication vs authorization?

Short answer: Authentication: Verifying the identity of a user (Who are you?) Authorization: Determining if the authenticated user has permission to perform an action (What are you allowed to do?) In ASP.NET Core, both a…

ASP.NET Core Read answer
Mid PDF
How to configure ASP.NET Core Identity

Short answer: ASP.NET Core Identity provides a complete solution for: User registration &amp; login Roles, claims, tokens Password hashing Two-factor authentication ✅ Setup: dotnet add package Microsoft.AspNetCore.Identi…

ASP.NET Core Read answer
Mid PDF
JWT Bearer tokens: what it is, how to configure?

Short answer: JWT (JSON Web Token) is a compact, URL-safe token format used for authentication. Explain a bit more ✅ Configure JWT auth: services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(op…

ASP.NET Core Read answer
Mid PDF
Role-based vs policy-based authorization?

Short answer: ✅ Role-based: [Authorize(Roles = &quot;Admin&quot;)] ✅ Policy-based: services.AddAuthorization(options =&gt; { options.AddPolicy(&quot;CanEdit&quot;, policy =&gt; policy.RequireClaim(&quot;EditPermission&qu…

ASP.NET Core Read answer
Mid PDF
Using Claims?

Short answer: Claims are user attributes (e.g., email, role, permissions). Add claims when creating identity: var claims = new List&lt;Claim&gt; { new Claim(ClaimTypes.Name, user.UserName), new Claim(&quot;Permission&quo…

ASP.NET Core Read answer

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

Short answer: SPNETCORE_ENVIRONMENT=Development ✅ Loaded in order of precedence, where later files override earlier ones.

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails 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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: appsettings.json: Base configuration file used across all environments. appsettings.{Environment}.json: Environment-specific overrides (e.g., Development, Production). 🔧 ASP.NET Core loads them automatically based on the environment: ASPNETCORE_ENVIRONMENT=Development ✅ Loaded in order of precedence, where later files override earlier ones.

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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: SP.NET Core uses the ASPNETCORE_ENVIRONMENT variable to determine the runtime environment. Supported environments (by convention): Development Staging Production Environment-specific logic can be applied: if (env.IsDevelopment()) { ... } lso used to load: appsettings.{env}.json Startup{env}.cs (in older versions)

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails 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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: Production) ASP.NET Core uses the ASPNETCORE_ENVIRONMENT variable to determine the runtime environment. Supported environments (by convention): Development Staging Production Environment-specific logic can be applied: if (env.IsDevelopment()) { ... } Also used to load: appsettings.{env}.json Startup{env}.cs (in older versions)

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails 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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: ✅ ASP.NET Core supports hierarchical override of config sources: Environment variables override appsettings.json: MyApp__Logging__LogLevel__Default=Warning Command line arguments override everything: dotnet run --Logging:LogLevel:Default=Debug

Real-world example (ShopNest)

ShopNest registers AppDbContext as Scoped and IMemoryCache as Singleton. Putting DbContext in a Singleton causes threading bugs.

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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: Inject IConfiguration anywhere: public class MyService {

Example code

private readonly string _apiKey;
public MyService(IConfiguration config) {
_apiKey = config["MySettings:ApiKey"];
}
} You can also access nested settings via config.GetSection("MySettings").

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails 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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: Bind config to strongly typed objects: public class MySettings {

Example code

public string ApiKey { get; set; }
public int Timeout { get; set; }
} services.Configure<MySettings>(config.GetSection("MySettings")); Use via IOptions<MySettings>.

Real-world example (ShopNest)

ShopNest registers AppDbContext as Scoped and IMemoryCache as Singleton. Putting DbContext in a Singleton causes threading bugs.

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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: IOptionsMonitor<T>) IOptions<T>: Reads settings once at startup. IOptionsSnapshot<T>: Gets updated settings per request (for scoped services). IOptionsMonitor<T>: Supports change notifications and works in singleton services. public MyService(IOptions<MySettings> options) {

Example code

var settings = options.Value;
}

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails 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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: User Secrets (for local dev): dotnet user-secrets init dotnet user-secrets set "MySettings:ApiKey" "secret" Azure Key Vault: builder.Configuration.AddAzureKeyVault(...); ✅ Secure sensitive data like API keys, connection strings, tokens.

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails 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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: In appsettings.json: "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } } Supports built-in providers: Console, Debug, EventSource, Azure, etc. Custom configuration through ILogger<T>.

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails 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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: Stored under "ConnectionStrings" section in appsettings.json: "ConnectionStrings": { "DefaultConnection": "Server=.;Database=AppDb;Trusted_Connection=True;" } Read via: var conn = config.GetConnectionString("DefaultConnection"); Or inject via Options pattern.

Example code

Stored under "ConnectionStrings" section in appsettings.json: "ConnectionStrings": { "DefaultConnection": "Server=.;Database=AppDb;Trusted_Connection=True;"
} Read via: var conn = config.GetConnectionString("DefaultConnection"); Or inject via Options pattern.

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails 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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: JSON files support live reload: builder.Configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true); IOptionsMonitor<T> automatically updates bound values when config changes. 🔁 Does not work with all sources (e.g., env vars, command line).

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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: Using POCOs and Options pattern allows type-safe config: services.Configure<MySettings>(config.GetSection("MySettings")); Use [Required], [Range], etc., to add validation.

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails 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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: You can validate bound config using IValidateOptions<T>: public class MySettingsValidator : IValidateOptions<MySettings> {

Example code

public ValidateOptionsResult Validate(string name, MySettings options) { if (string.IsNullOrWhiteSpace(options.ApiKey)) {
return ValidateOptionsResult.Fail("ApiKey is required."); }
return ValidateOptionsResult.Success;
}
} Register with DI: services.AddSingleton<IValidateOptions<MySettings>, MySettingsValidator>();

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails 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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: ASP.NET Core supports multiple configuration providers: JSON (default) Environment Variables Command Line Args INI files XML files In-memory Azure App Configuration Azure Key Vault Secrets Manager Each can be chained with priority.

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails 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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: Use default values in POCOs or fallback logic: public class MySettings {

Example code

public string ApiKey { get; set; } = "default-api-key";
} Or: var apiKey = config["MySettings:ApiKey"] ?? "fallback";

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails 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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: Default values and optional settings Use default values in POCOs or fallback logic: public class MySettings { public string ApiKey { get; set; } = "default-api-key"; } Or: var apiKey = config["MySettings:ApiKey"] ?

Explain a bit more

is a common interview topic in ASP.NET Core. Give a clear definition, then one concrete example. Default values and optional settings Use default values in POCOs or fallback logic: public class MySettings { public string ApiKey { get; set; } = "default-api-key"; } Or: var apiKey = config["MySettings:ApiKey"] ? is a common interview topic in ASP.NET Core. Give a clear definition, then one concrete example.

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails 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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: uthentication &amp; Authorization (JWT, Identity) uthentication &amp; Authorization (JWT, Identity) uthentication &amp; Authorization (JWT, Identity) uthentication &amp; Authorization (JWT, Identity)

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails 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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: ✅ Best practices: Don't log sensitive values Use [JsonIgnore] or remove values before logging Mask in logs manually: _logger.LogInformation("Token: {Token}", Mask(token)); Never store secrets in source-controlled files (appsettings.json) Use user-secrets, Key Vault, or environment variables instead Authentication & Authorization (JWT, Identity)

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails 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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: ction (What are you allowed to do?) In ASP.NET Core, both are handled via middleware and attributes like [Authorize], roles, nd policies.

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails 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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: Authentication: Verifying the identity of a user (Who are you?) Authorization: Determining if the authenticated user has permission to perform an action (What are you allowed to do?) In ASP.NET Core, both are handled via middleware and attributes like [Authorize], roles, and policies.

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails 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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: ASP.NET Core Identity provides a complete solution for: User registration & login Roles, claims, tokens Password hashing Two-factor authentication ✅ Setup: dotnet add package Microsoft.AspNetCore.Identity.EntityFrameworkCore In Startup or Program.cs: services.AddIdentity<IdentityUser, IdentityRole>() .AddEntityFrameworkStores<ApplicationDbContext>() .AddDefaultTokenProviders();

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails 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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: JWT (JSON Web Token) is a compact, URL-safe token format used for authentication.

Explain a bit more

✅ Configure JWT auth: services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(options => { options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuer = true, ValidateAudience = true, ValidateLifetime = true, ValidateIssuerSigningKey = true, IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("your-secret")) }; }); Use [Authorize] to secure endpoints.

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails 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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: ✅ Role-based: [Authorize(Roles = "Admin")] ✅ Policy-based: services.AddAuthorization(options => { options.AddPolicy("CanEdit", policy => policy.RequireClaim("EditPermission")); }); Then use: [Authorize(Policy = "CanEdit")] Policy-based gives more flexibility (custom requirements, claims, logic).

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails 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 ASP.NET Core Tutorial · ASP.NET Core

Short answer: Claims are user attributes (e.g., email, role, permissions). Add claims when creating identity: var claims = new List<Claim> { new Claim(ClaimTypes.Name, user.UserName), new Claim("Permission", "Edit") }; Access in code: var claim = User.FindFirst("Permission")?.Value;

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