Unit 4: Asp.Net MVC and Security - Subjective Questions

INT402 — Modern Web Programming Tools And Techniques • Practice Questions with Detailed Answers

20 questions

1

Define the middleware request pipeline in ASP.NET Core. Explain how an HTTP request and response travel through the pipeline.

2

Distinguish between the Use, Run, and Map methods used to configure the ASP.NET Core request pipeline.

3

Explain why the order of middleware components is important in an ASP.NET Core application. Give suitable examples.

4

Describe any five commonly used built-in middleware components in ASP.NET Core and state the purpose of each.

5

What is custom middleware? Describe the steps required to create and register a class-based custom middleware component in ASP.NET Core.

6

Develop a custom ASP.NET Core middleware component that measures request-processing time. Explain its operation and registration.

7

Define Dependency Injection (DI). Explain the roles of service registration, the service container, and service resolution in ASP.NET Core.

8

Compare the Transient, Scoped, and Singleton service lifetimes in ASP.NET Core. Give an appropriate use case for each.

9

Explain how to implement constructor-based dependency injection in an ASP.NET Core MVC controller with a suitable example.

10

Discuss common dependency-injection mistakes in ASP.NET Core, including the service locator pattern, captive dependencies, and incorrect disposal.

11

What is the Code First approach in Entity Framework Core? Describe the complete process for creating a database from model classes.

12

Explain the purpose of DbContext, DbSet<TEntity>, connection strings, and database providers in an Entity Framework Core application.

13

Describe Entity Framework Core migrations. How are migrations created, applied, rolled back, and maintained in a team project?

14

What is the Database First approach in Entity Framework Core? Explain how an existing database can be reverse-engineered into an ASP.NET Core application.

15

Compare the Code First and Database First approaches. State the advantages, limitations, and suitable use cases of each.

16

Explain how entity relationships are represented in Entity Framework Core. Discuss one-to-one, one-to-many, and many-to-many relationships.

17

Distinguish between authentication and authorization in a web application. Explain how they are related.

18

Describe cookie-based authentication and token-based authentication in ASP.NET Core. Compare their typical uses and security considerations.

19

Explain role-based, claims-based, and policy-based authorization in ASP.NET Core. Provide a suitable scenario for each.

20

Design a secure authentication and authorization flow for an ASP.NET Core MVC application. Include service configuration, middleware order, access control, and major security precautions.