You're trying to create a basic form in a Razor view to capture user feedback. Which tag helper would you use to create a textbox for users to type in their comments?

  • asp-input
  • asp-textbox
  • asp-text
  • asp-form
To create a textbox for user input in a Razor view, you would use the asp-textbox tag helper. This helper generates the necessary HTML input element, and you can specify its attributes and bindings using the asp-for attribute. It's a handy tool for creating forms in ASP.NET Core views.

For a Web API, you're required to ensure that only authenticated users can access specific endpoints, but some endpoints should be public. How would you achieve this in ASP.NET Core?

  • Use Authentication Filters
  • Use Authorization Filters
  • Configure Middleware
  • Use Role-Based Authorization
To control access to specific endpoints in an ASP.NET Core Web API, you'd use Authorization Filters. You can apply policies to controllers or actions, and these filters can determine whether a user is authorized to access the resource based on their identity and role. To make some endpoints public, you can use AllowAnonymous attribute or configure policies accordingly.

Which template should you choose when you need both Razor-based web pages and API controllers?

  • Web Application
  • Web API
  • Empty
  • Blazor
The "Web Application" template is the suitable choice when you need both Razor-based web pages for user interfaces and API controllers for handling data interactions. This template provides a balanced setup for creating web applications that combine server-rendered Razor pages with APIs for data exchange.

What purpose do Razor Tag Helpers serve in ASP.NET Core?

  • Simplify server-side code in Razor views
  • Generate CSS styles
  • Handle routing in controllers
  • Create REST APIs
Razor Tag Helpers in ASP.NET Core simplify server-side code in Razor views by providing a more natural way to work with HTML elements and attributes. They make it easier to integrate server-side logic into your views while maintaining clean and readable code.

What is the primary purpose of the Register action in a typical ASP.NET Core Identity controller?

  • Allowing users to log in
  • Handling user registration
  • Managing user profiles
  • Deleting user accounts
The primary purpose of the Register action in an ASP.NET Core Identity controller is to handle user registration. It processes user-provided information, such as username, password, and email, and creates a new user account in the system, allowing them to log in subsequently.

Which of the following is a built-in Razor Tag Helper in ASP.NET Core?

The tag helper is a built-in Razor Tag Helper in ASP.NET Core. It is used to generate links and forms with correct routing information, making it easier to create URLs that are strongly typed and route to the appropriate controller actions.

You've been introduced to Razor Tag Helpers in ASP.NET Core and want to understand their basic usage. What are Tag Helpers primarily used for in Razor views?

  • Formatting date and time values
  • Generating HTML elements with server-side logic
  • Creating CSS styles
  • Running JavaScript code
Tag Helpers in Razor views are primarily used for generating HTML elements with server-side logic. They allow you to create dynamic HTML elements and attributes based on server-side data and logic, making it easier to work with server-side data in your views.

After setting up your new ASP.NET Core website, you find that your site's main logo and stylesheet aren't loading. What could be a potential reason for this issue?

  • Incorrect file paths or URLs
  • Incompatible browser
  • Server overload
  • Database connection issue
One of the common reasons for missing images and stylesheets in a web application is incorrect file paths or URLs. Check that the paths specified in your HTML or CSS files are accurate and relative to the 'wwwroot' folder.

Using the {id:int} syntax in an attribute route enforces that the id parameter must be of type ______.

  • String
  • Integer
  • Double
  • DateTime
The {id:int} syntax in an attribute route specifies that the id parameter must be of type integer. This is a way to ensure that the data passed in the URL is an integer value, and if it's not, the route won't match.

For projects focused on background tasks and might run as Windows services or Linux daemons, you should use the ________ template.

  • Worker
  • Web API
  • Blazor
  • MVC
The Worker template in ASP.NET Core is specifically designed for projects that focus on background tasks. It's ideal for creating services that perform work in the background and can be run as Windows services or Linux daemons. This template provides the necessary infrastructure for background task execution.