Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Answer: For large uploads, use IFormFile, Stream, or read from Request.Body for streaming. For downloads, return FileStreamResult. Enable buffering or streaming to avoid memory overload. What interviewers expect A clear…
Answer: pp.UseExceptionHandler(config => { config.Run(async context => { // Log and return problem details }); }); Or use ProblemDetails for structured error responses. What interviewers expect A clear defi…
Use UseExceptionHandler middleware or custom ExceptionMiddleware. You can also create a global error handler: app.UseExceptionHandler(config => { config.Run(async context => { // Log and return problem details });…
Use proper status codes: 200 OK (success) 201 Created (on POST) 204 No Content (on DELETE) 400 Bad Request 401 Unauthorized / 403 Forbidden 404 Not Found 500 Internal Server Error return Ok(result); return NotFound(); re…
ActionResult<T>: Combines a return value and response code. public ActionResult<Product> Get(int id) { ... } IActionResult: More flexible, returns different result types explicitly. Prefer ActionResult<T&g…
SP.NET Core supports full async/await pattern for IO-bound tasks. [HttpGet] public async Task<ActionResult<Product>> GetAsync(int id) { var product = await _repo.GetAsync(id); return product == null ? NotFoun…
NotFound() : Ok(product); ✅ Improves scalability and performance. What interviewers expect A clear definition tied to ASP.NET Core in ASP.NET Core projects Trade-offs (performance, maintainability, security, cost) When y…
Enable CORS (Cross-Origin Resource Sharing) to allow client apps from different domains: services.AddCors(options => { options.AddPolicy("AllowFrontend", builder => builder.WithOrigins(" .AllowAnyHeader() .AllowAny…
Answer: It can enforce rate limiting to prevent abuse and throttling to limit the number of requests a client can make. What interviewers expect A clear definition tied to ASP.NET Core in ASP.NET Core projects Trade-offs…
Answer: pp.UseSwagger(); pp.UseSwaggerUI(); Supports: Auto-generated OpenAPI docs Try it out interface Versioning support What interviewers expect A clear definition tied to ASP.NET Core in ASP.NET Core projects Trade-of…
Answer: Use Swashbuckle.AspNetCore or NSwag for generating Swagger docs. services.AddSwaggerGen(); app.UseSwagger(); app.UseSwaggerUI(); Supports: Auto-generated OpenAPI docs Try it out interface Versioning support What…
Unit testing: Mock services/repositories using Moq or FakeItEasy. Integration testing: Use WebApplicationFactory<T> + TestServer + HttpClient. var client = _factory.CreateClient(); var response = await client.GetAs…
Use JWT Bearer Tokens for stateless auth: services.AddAuthentication(JwtBearerDefaults.AuthenticationSch eme) .AddJwtBearer(options => { ... }); Secure endpoints with: [Authorize(Roles = "Admin")] OAuth supported via…
Answer: HTTPS: Enforced via UseHttpsRedirection() CORS: Limit origins using policies Anti-forgery: Usually not needed for APIs unless using cookies (use ValidateAntiForgeryToken) Use authentication + authorization checks…
Answer: DTOs decouple internal models from API contracts. Use AutoMapper for mapping: CreateMap&lt;Product, ProductDto&gt;(); var dto = _mapper.Map&lt;ProductDto&gt;(product); What interviewers expect A c…
Answer: Avoid breaking changes to existing endpoints. Use new versions for changes in contracts. Maintain old versions as long as needed. Ensure documentation and clients are updated accordingly. What interviewers expect…
Use RowVersion / ETag to detect concurrent edits. Example with EF Core: modelBuilder.Entity<Product>() .Property(p => p.RowVersion).IsRowVersion(); Return 409 Conflict if concurrency exception is caught. Model B…
Answer: SP.NET Core automatically binds data based on parameter types and attributes ([FromBody], [FromQuery], etc.). What interviewers expect A clear definition tied to ASP.NET Core in ASP.NET Core projects Trade-offs (…
Model binding in ASP.NET Core maps incoming HTTP data to C# parameters or model properties. 🔍 Sources considered: Route data Query string Form data Headers JSON body (application/json) Uploaded files Services (via [From…
Simple types (int, string, bool, DateTime, etc.): Bound from route, query string, or form fields. Complex types (custom classes): Bound from multiple sources like query/form fields or JSON body. public IActionResult Crea…
Use a custom model binder when default binding doesn’t work (e.g., custom formats, headers). public class CustomBinder : IModelBinder { public Task BindModelAsync(ModelBindingContext context) { // Custom logic here } } R…
[FromQuery], etc.) You cannot bind multiple [FromBody] parameters in a single action. Common sources: [FromBody] — for JSON/XML payloads [FromQuery] — query string [FromRoute] — route values [FromForm] — form fields and…
Answer: Decorate models with attributes: public class User { [Required] [StringLength(50)] [EmailAddress] public string Email { get; set; } } Used in both MVC and API for validation. What interviewers expect A clear defi…
Answer: Server-side: Always performed on the server; use ModelState.IsValid. Client-side: HTML5 + jQuery Unobtrusive Validation (for MVC/Razor Pages). Client-side validation improves UX, but server-side is essential for…
Create custom rules by inheriting ValidationAttribute: public class MustBeEvenAttribute : ValidationAttribute { public override bool IsValid(object value) { return (int)value % 2 == 0; } } Use like: [MustBeEven] public i…
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: For large uploads, use IFormFile, Stream, or read from Request.Body for streaming. For downloads, return FileStreamResult. Enable buffering or streaming to avoid memory overload.
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: pp.UseExceptionHandler(config => { config.Run(async context => { // Log and return problem details }); }); Or use ProblemDetails for structured error responses.
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Use UseExceptionHandler middleware or custom ExceptionMiddleware.
You can also create a global error handler:
app.UseExceptionHandler(config => {
config.Run(async context => {
// Log and return problem details
});
});
Or use ProblemDetails for structured error responses.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Use proper status codes:
return Ok(result);
return NotFound();
return BadRequest(ModelState);ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
public ActionResult<Product> Get(int id) { ... }
Prefer ActionResult<T> for simpler, strongly-typed APIs.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
SP.NET Core supports full async/await pattern for IO-bound tasks.
[HttpGet]
public async Task<ActionResult<Product>> GetAsync(int id) {
var product = await _repo.GetAsync(id);
return product == null ? NotFound() : Ok(product);
}
✅ Improves scalability and performance.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
NotFound() : Ok(product); ✅ Improves scalability and performance.
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Enable CORS (Cross-Origin Resource Sharing) to allow client apps from
different domains:
services.AddCors(options => {
options.AddPolicy("AllowFrontend", builder =>
builder.WithOrigins("
.AllowAnyHeader()
.AllowAnyMethod());
});
app.UseCors("AllowFrontend");
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: It can enforce rate limiting to prevent abuse and throttling to limit the number of requests a client can make.
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: pp.UseSwagger(); pp.UseSwaggerUI(); Supports: Auto-generated OpenAPI docs Try it out interface Versioning support
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: Use Swashbuckle.AspNetCore or NSwag for generating Swagger docs. services.AddSwaggerGen(); app.UseSwagger(); app.UseSwaggerUI(); Supports: Auto-generated OpenAPI docs Try it out interface Versioning support
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
+ HttpClient.
var client = _factory.CreateClient();
var response = await client.GetAsync("/api/products");ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
services.AddAuthentication(JwtBearerDefaults.AuthenticationSch
eme)
.AddJwtBearer(options => { ... });
[Authorize(Roles = "Admin")]
providers.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: HTTPS: Enforced via UseHttpsRedirection() CORS: Limit origins using policies Anti-forgery: Usually not needed for APIs unless using cookies (use ValidateAntiForgeryToken) Use authentication + authorization checks for all endpoints
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: DTOs decouple internal models from API contracts. Use AutoMapper for mapping: CreateMap<Product, ProductDto>(); var dto = _mapper.Map<ProductDto>(product);
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: Avoid breaking changes to existing endpoints. Use new versions for changes in contracts. Maintain old versions as long as needed. Ensure documentation and clients are updated accordingly.
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Example with EF Core:
modelBuilder.Entity<Product>()
.Property(p => p.RowVersion).IsRowVersion();
Return 409 Conflict if concurrency exception is caught.
Model Binding & Validation
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: SP.NET Core automatically binds data based on parameter types and attributes ([FromBody], [FromQuery], etc.).
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Model binding in ASP.NET Core maps incoming HTTP data to C# parameters or model
properties.
🔍 Sources considered:
ASP.NET Core automatically binds data based on parameter types and attributes
([FromBody], [FromQuery], etc.).
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
form fields.
or JSON body.
public IActionResult Create([FromBody] Product product)ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Use a custom model binder when default binding doesn’t work (e.g., custom formats,
headers).
public class CustomBinder : IModelBinder {
public Task BindModelAsync(ModelBindingContext context) {
// Custom logic here
}
}
Register with [ModelBinder] or globally in Startup.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
[FromQuery], etc.)
You cannot bind multiple [FromBody] parameters in a single action.
Common sources:
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: Decorate models with attributes: public class User { [Required] [StringLength(50)] [EmailAddress] public string Email { get; set; } } Used in both MVC and API for validation.
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Answer: Server-side: Always performed on the server; use ModelState.IsValid. Client-side: HTML5 + jQuery Unobtrusive Validation (for MVC/Razor Pages). Client-side validation improves UX, but server-side is essential for security.
In a production ASP.NET Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Create custom rules by inheriting ValidationAttribute:
public class MustBeEvenAttribute : ValidationAttribute {
public override bool IsValid(object value) {
return (int)value % 2 == 0;
}
}
Use like:
[MustBeEven]
public int Number { get; set; }