_________ is the lightweight, cross-platform web server used by default with ASP.NET Core.
- Apache
- IIS
- Kestrel
- Nginx
Kestrel is the lightweight, cross-platform web server that is used by default with ASP.NET Core. It's designed for high performance and is well-suited for hosting ASP.NET Core applications. Developers can also use it in combination with reverse proxy servers like Nginx or Apache for production deployments.
Which of the following is NOT a standard provider for ASP.NET Core Identity user authentication?
- OAuth
- OpenID Connect
- JWT
- Cookie
ASP.NET Core Identity provides user authentication, but it doesn't include OAuth as a standard provider. OAuth is a separate authorization framework that can be used with ASP.NET Core for scenarios like external logins, but it's not part of the Identity system.
In your ASP.NET Core application, you notice that some middleware is not executing as expected. Considering the middleware pipeline, what could be the potential reason?
- The middleware order is incorrect.
- The application is not running on a supported OS.
- The middleware is not properly configured.
- The server is overloaded.
In the ASP.NET Core middleware pipeline, the order in which middleware components are added matters. If the middleware order is incorrect, it can lead to unexpected behavior. Middleware components are executed in the order they are added to the pipeline.
Which ASP.NET Core feature allows you to implement authentication and authorization logic to protect your Web APIs?
- Dependency Injection
- Middleware
- Entity Framework Core
- Identity
Identity is an ASP.NET Core feature that allows you to implement authentication and authorization logic to secure your Web APIs. It provides user management, role-based access control, and authentication mechanisms like JWT (JSON Web Tokens) out of the box. Developers can easily integrate Identity into their ASP.NET Core applications to manage user authentication and authorization requirements.
You're developing a multi-page ASP.NET Core application. For most pages, you want to use the same header and footer, but for a few pages, you want a different header. How would you best accomplish this with Razor Views?
- Create a custom layout for pages with different headers.
- Use conditional statements in the Razor layout to determine which header to display.
- Create separate views for pages with different headers.
- Modify the _Layout.cshtml file for each page.
To achieve different headers for specific pages in an ASP.NET Core application, you can create a custom layout for those pages. This approach allows you to maintain a consistent structure while customizing headers for specific pages.
In the context of ASP.NET Core MVC, where are the business rules and logic typically located?
- View
- Controller
- Model
- Startup.cs
In ASP.NET Core MVC, the business rules and logic are typically located in the Model. The Model represents the application's core logic and data handling, making it the ideal place to implement and enforce business rules. This separation of concerns helps maintain a clean and organized codebase.
In ASP.NET Core Identity, what's the best way to customize the hashing algorithm used for storing passwords?
- Implement a custom PasswordHasher
- Modify the Startup.cs file
- Use a third-party library
- Edit the appsettings.json file
The best way to customize the password hashing algorithm in ASP.NET Core Identity is by implementing a custom PasswordHasher. This allows you to have full control over the hashing process, ensuring it meets your specific security requirements.
When performing unit testing in ASP.NET Core, what attribute is commonly used to signify a method as a test method?
- [TestMethod]
- [UnitTest]
- [Test]
- [TestFunction]
In ASP.NET Core unit testing, the [Test] attribute is commonly used to signify a method as a test method. This attribute is part of popular unit testing frameworks like MSTest and xUnit.
For a scenario where you want to return different types of responses (e.g., JSON or HTML) based on some conditions, which action result provides the flexibility to achieve this?
- ContentResult
- PartialViewResult
- ObjectResult
- ActionResult
The ActionResult action result provides the flexibility to return different types of responses based on conditions. It's a base class for other action results in ASP.NET Core, allowing you to return various derived result types like JsonResult, ViewResult, or ContentResult. Depending on your conditions, you can choose the appropriate derived result type to return different responses, such as JSON or HTML.
Which feature of EF Core allows developers to execute raw SQL commands directly against the database?
- SQL Executor
- SQL Raw Execute
- Raw SQL Queries
- ExecuteSQL
EF Core provides a feature called "Raw SQL Queries" that allows developers to execute raw SQL commands directly against the database. This feature is useful when you need to run complex or specific SQL queries that cannot be easily expressed using LINQ or the query builder methods provided by EF Core.