Unsectioned

Preview this deck

What is the name of the Microsoft build engine?

Front

Star 100%
Star 100%
Star 100%
Star 100%
Star 100%

5.0

1 review

5
1
4
0
3
0
2
0
1
0

Active users

37

All-time users

42

Favorites

1

Last updated

4 years ago

Date created

Jun 29, 2020

Cards (167)

Unsectioned

(167 cards)

What is the name of the Microsoft build engine?

Front

MSBuild

Back

Where is the runtime environment for ASP.NET Core set?

Front

In the Properties/launchSettings.json file. (ASPNETCORE_ENVIRONMENT variable)

Back

Which middleware method adds a simple message to HTTP responses that would not otherwise have a body (such as 404 - Not Found responses)?

Front

app.UseStatusCodePages()

Back

Which IApplicationBuilder method is used to add a class-based custom middleware component to the request pipeline?

Front

app.UseMiddleware<CustomMiddlewareClassName>();

Back

Which HttpContext property returns an HttpResponse object that is used to create a response to the HTTP request?

Front

HttpContext.Response

Back

Which HttpContext property returns a ConnectionInfo object that provides information about the network connection underlying the HTTP request, including details of local and remote IP addresses and ports?

Front

HttpContext.Connection

Back

CLI command to execute the commands in an Entity Framework database migration, thereby updating the database?

Front

dotnet ef database update

Back

Which method adds a middleware component that displays details of unhandled exceptions (usually for use in dev environments)?

Front

app.UseDeveloperExceptionPage()

Back

Which project folder (hidden by Visual Studio by default) contains the intermediate output from the compiler?

Front

/obj

Back

What are the necessary elements of an Extension Method?

Front
  • Must be defined in Static classes
  • Must be within the same namespace as the extended class
  • Method must be static
  • Method's first parameter is this and the Class being extended. (e.g. TotalPrices(this ShoppingCart cart) )
Back

What does the HttpResponse.WriteAsync(data) method do?

Front

It writes a data string to the response body

Back

What does the acronym JSON stand for?

Front

JavaScript Object Notation

Back

Which async method on the HttpResponse object enables you to write a data string to the response body?

Front

HttpResponse.WriteAsync(data)

Back

Since Tag Helpers can't be discovered automatically (unlike controllers and view), where can they be registered?

Front

_ViewImports.cshtml

Back

What HttpContext property provides access to the services available for the request?

Front

HttpContext.RequestServices

Back

What does the HttpContext.Features property provide access to?

Front

Request features, which allows access to the low-level aspects of request handling.

Back

How does the ASP.NET Core routing system decide which route to select if there are multiple matches?

Front

Each matching route is given a score and the route with the lowest score is selected. In general, the most specific route receives the request. Literal Segments before Segment Variables, and Segment Variables with constraints before those without. If two routes have the same score, then an Ambiguous Routing error is thrown.

Back

Which HttpRequest property returns a stream that can be used to read the request body?

Front

HttpRequest.Body

Back

In ASP.NET Core routing, what are Fallback Routes, and which method is used to create them?

Front

Fallback Routes are routes that direct a request to an endpoint only when no other route matches a request. They prevent requests from being passed further along the request pipeline by ensuring that the routing system will always generate a response. They are created with the MapFallback method.

 

Ex:

endpoints.MapFallback(async context => {

  await context.Response.WriteAsync("Routed to fallback endpoint");

});

Back

CLI command for installing tools

Front

dotnet tool

Back

What does the HttpContext.RequestServices property provide access to?

Front

The services available for the request

Back

When adding a custom middleware component in ASP.NET Core, why might you want to use a class instead of a lambda function?

Front

Using lambda functions is convenient, but it can lead to a long and complex Configure method in Startup. Also, using a class enables reuse of the custom middleware component across different projects.

Back

Which HttpRequest property returns the path section of the request URL?

Front

HttpRequest.Path

Back

How do you set the status code for the HTTP response in ASP.NET Core?

Front

HttpResponse.StatusCode

Back

What does the HttpContext.Response property return?

Front

An HttpResponse object that is used to create a response to the HTTP request.

Back

Where is the cache created by AddDistributedMemoryCache stored?

Front

In memory as a part of the ASP.NET Core process, which means that applications that run on multiple servers or containers don't share cached data. It also means the contents of the cache are lost when ASP.NET Core is stopped.

Back

The User property which describes the user associated with the current request is a member of which class?

Front

ControllerBase

Back

Which class is responsible for configuring an ASP.NET Core application?

Front

The Startup class

Back

ASP.NET automatically maps requests for static content (images, CSS, JS) to which folder?

Front

wwwroot

Back

What does it mean if an ASP.NET Core middleware component short-circuits the pipeline?

Front

The middleware component has chosen not to call the next function, so the request isn't passed on.

Back

Which HttpResponse property returns true if ASP.NET Core has started to send the response headers to the client (after which it is not possible to make changes)?

Front

HttpResponse.HasStarted

Back

Which tag helper is applied to a div to show a list of validation errors?

Front

asp-validation-summary

Back

What is the name of the class associated with a Razor Page?

Front

The page model class (myPage.cshtml.cs)

Back

What is the syntax for the Null Conditional Operator

Front

?. (e.g. myObject?.myProperty)

Back

Which IApplicationBuilder method registers a middleware component? (Typically expressed as a lambda function that receives each request as it passes through the request pipeline.)

Front

app.Use(async (context, next) =>

Back

In ASP.NET Core, when is a URL considered a match for a URL Pattern in a route definition?

Front
  • The URL contains the same number of segments
  • Each segment has the same content as the pattern
Back

What are the two methods included in Startup.cs by default?

Front

ConfigureServices

Configure

Back

What does Visual Studio use instead of the built-in ASP.NET Core HTTP Server?

Front

Visual Studio uses IIS Express as a reverse proxy for the built-in ASP.NET Core HTTP server (Kestral).

Back

How many bits in a byte?

Front

8 bits in a byte

Back

What is the Visual Studio hotkey to start without debugging

Front

Ctrl-F5

Back

What is the name of the HTTP server that ASP.NET Core uses?

Front

Kestral

Back

How can you tell if a request was made using HTTPS in ASP.NET Core?

Front

The HttpRequest.IsHttps property

Back

In ASP.NET Core, what is the purpose of the Host?

Front

The host encapsulates all of the app's resources, such as:

  • An HTTP server implementation
  • Middleware components
  • Logging
  • Dependency injection (DI) services
  • Configuration
Back

Which HttpContext property returns the session data associated with the request?

Front

HttpContext.Session

Back

To what does ASP.NET Core delegate the the work of receiving and responding to HTTP requests?

Front

To middleware components which are arranged in a chain known as the request pipeline.

Back

CLI command for creating an Entity Framework migration?

Front

dotnet ef migrations add {migrationName}

Back

Which method in the Startup class is used to register the middleware components for the request pipeline?

Front

The Configure method

Back

In ASP.NET Core routing, what's another term for route parameters?

Front

Segment Variables

Back

When is a new instance of the Controller class created? (i.e. What is its scope?)

Front

A new instance of the controller class is created every time one of its actions is used to handle a request.

Back

In ASP.NET Core, what system is responsible for selecting the endpoint that will handle an HTTP request?

Front

The Routing System

Back

Which file is the entry point for the ASP.NET Core platform?

Front

Program.cs

Back

Any class can be used as a service, and there are no restrictions on the features a service can provide, so what makes services special?

Front

They are managed by ASP.NET Core, and dependency injection makes it possible to access services anywhere in the application, including in middleware components.

Back

What HttpContext property returns an HttpRequest object that describes the HTTP request being processed?

Front

HttpContext.Request

Back

What could you use to add a method to a class that you cannot modify directly?

Front

An Extension Method

Back

Which project file is used to select a specific version of the .NET Core SDK?

Front

global.json

Back

What is the collective term for objects returned from Action Methods. (e.g. ViewResult, RedirectResult, HttpUnauthorizedResult)

Front

Action Results

Back

For which process is the XML describing a project in the .csproj file primarily for?

Front

MSBuild

Back

How can you access the request cookies in ASP.NET Core?

Front

The Cookies property of the HttpRequest and HttpResponse objects

 

Usage:

context.Request.Cookies.Append("key", "value")

context.Request.Cookies["key"]

context.Response.Cookies.Delete("key")

Back

What is a delegate?

Front

A type that represents references to methods with a particular parameter list and return type. Delegates are used to pass methods as arguments to other methods.

Back

What is an Extension Method?

Front

A way to add methods to classes that you cannot modify directly.

Back

Which HttpRequest property returns the query string section of the request URL as key/value pairs?

Front

HttpRequest.Query

Back

In ASP.NET Core, what does the Append method of  HttpResponse.Cookies do?

Front

Creates or replaces a cookie in the response.

 

Usage:

context.Response.Cookies.Append("name", "value", 

  new CookieOptions { ... })

Back

CLI Item template to create a solution file.

Front

dotnet new sln -o MySolution

Back

Which common pattern in ASP.NET Core is used to ensure exception handling middleware is only added to Development and HSTS middleware is only added outside of development?

Front

if (env.IsDevelopment()) {

  app.UseDeveloperExceptionPage();

} else {

  app.UseHsts();

}

Back

Which HTTP method is used to update part of an existing object?

Front

PATCH

Back

What is a "route"?

Front

A rule that is used to decide how a request is handled.

Back

CLI command to create a project

Front

dotnet new

Back

In ASP.NET Core routing, how are optional segments used and denoted?

Front

Optional segments allow the route to match URLs that don't have a corresponding path segment. They are denoted with a question mark.

 

Ex: endpoints.MapGet("size/{city?}, ...

Back

What two things does the ASP.NET Core Routing System do?

Front
  1. Handles incoming requests from clients
  2. Generates outoging URLs that conform to the URL scheme (and which can be embedded in web pages)
Back

Which interface provides access to URL-generating functionality?

Front

IUrlHelper

Back

Where is Startup.cs configured to be the next step in the startup process (after Main)?

Front

In the CreateHostBuilder method of Program.cs.

 

CreateHostBuilder(string[] args) =>

  Host.CreateDefaultBuilder(args)

    .ConfigureWebHostDefaults(webBuilder => {

       webBuilder.UseStartup<Startup>();

});

Back

CLI command to build and run a project

Front

dotnet run (dotnet build just builds it)

Back

Which keyword does pattern matching (to test that an object is of a specific type or has specific characteristics)?

Front

is 

 

(e.g. if( data[i] is decimal d) )

Back

Other than the VS NuGet Package Manager, what other package manager is there?

Front

The Client-Side Library Manager (for things like Bootstrap)

Back

What does the HttpContext.Request property return?

Front

An HttpRequest object that describes the HTTP request being processed

Back

Which project folder (hidden by Visual Studio by default) contains the compiled application files?

Front

/bin

Back

What happens if no response is generated by the middleware components in ASP.NET Core's request pipeline?

Front

ASP.NET Core will return a response with the HTTP 404 Not Found status code.

Back

Which statement in the Configure method of the Startup class in an ASP.NET Core project adds support for responding to HTTP requests with static content?

Front

app.UseStaticFiles

Back

What is the ASP.NET Core dependency injection feature used for?

Front

For creating and consuming services, and makes it easy to create the components in a loosely-coupled way.

Back

Which middleware method enables support for serving static content from the wwwroot folder?

Front

app.UseStaticFiles()

Back

What does the HttpContext.Session property return?

Front

The session data associated with the request

Back

Which HTTP Method is used to update an existing object?

Front

PUT

Back

What does the HttpResponse.HasStarted property tell you?

Front

It returns true if ASP.NET Core has started to send the response headers to the client, after which it is not possible to make changes.

Back

In an ASP.NET Core application, what is the term for the thing that handles incoming requests?

Front

An Endpoint

Back

Which two method calls must be added to the ASP.NET Core Startup class to use MVC?

Front

services.AddControllers() in ConfigureServices

endpoints.MapControllers() in the UseEndpoints method of Configure

Back

In ASP.NET, what is an Endpoint?

Front

The thing that handles incoming requests.

Back

In ASP.NET Core routing, how are default value for segment variables used?

Front

The default values are used when the URL doesn't contain a value for the corresponding segment. This increases the range of URLs that the route can match.

 

Ex: endpoints.MapGet("capital/{country=France}", ...

Back

In ASP.NET, what is the term for a rule that is used to decide how a request is handled?

Front

A route

Back

What property is provided by the Controller Base Class to provide details of the outcome of the Model Binding process?

Front

ModelState

Back

CLI command to list the packages installed in a project?

Front

dotnet list package

Back

What does TLS stand for?

Front

Transport Layer Security

 

(It replaces the obsolete SSL protocol, even though the term "SSL" has become synonymous with secure networking and is often used when TLS is actually being used.)

Back

What does ASP.NET Core do with the HTTP requests it receives?

Front

It passes them along a request pipeline (which is populated with middleware components).

Back

What two objects does the ASP.NET Core platform create when a new HTTP request arrives?

Front

An object that describes the request and a corresponding object describing the response that will be sent in return. These objects are passed to the first middleware component which inspects the request, modifies the response, and passes them on to the next middleware component in the chain. Once the request has made its way through the pipeline, the ASP.NET Core platform sends the response.

Back

What is the primary purpose of the ASP.NET Core platform?

Front

To receive HTTP requests and send responses to them.

Back

What is the purpose of the ActivatorUtilities class (defined in the Microsoft.Extensions.DependencyInjection namespace)?

Front

It provides methods for instantiating classes that have dependencies declared through their constructor.

 

Ex: 

CreateInstance<T>(services, args)

GetServiceOrCreateInstance<T>(services, args)

Back

Which file (hidden by Visual Studio by default) is used to configure the ASP.NET Core application when it starts?

Front

Properties/launchSettings.json

Back

Where is the ModelState property defined?

Front

In the Controller Base Class

Back

On which port does the integrated ASP.NET Core HTTP server listen?

Front

5000

Back

In ASP.NET Core routing, how are constraints on segment matches denoted?

Front

With a colon. They can also be combined.

 

Examples: 

{first:int}/{second:bool}/{third:alpha}

{first:alpha:length(3)}/{second:regex(^uk|france|monaco$)}

Back

Why is it preferable to use Tag Helpers rather than including blocks of C# code in a view?

Front

Because Tag Helpers can be easily unit tested.

Back

Where are the request pipeline middleware components registered?

Front

In the Configure method of the Startup class

Back

What are Action Results?

Front

The collective term for objects returned from Action Methods. (e.g. ViewResult, RedirectResult, HttpUnauthorizedResult)

Back

How does the Session Cookie work in ASP.NET Core?

Front

When a request containing a Session Cookie is received, the session middleware component retrieves the server-side data associated with the session and makes it available through the HttpContext object.

Back

In ASP.NET which ControllerBase property returns the data extracted from the request url by the routing middleware?

Front

RouteData

Back

CLI command to add packages to a project

Front

dotnet add package

Back

Which file is used to configure the ASP.NET Core runtime and its associated frameworks?

Front

Startup.cs

Back

In which folder should Views for components be located (by convention)?

Front

Views/Shared/Components/{Component Name}/

Back

What does the HttpRequest.ContentType property return?

Front

The value of the Content-Type header

Back

Can middleware components be configured?

Front

Yes. A common pattern for this is the options pattern which defines a class containing config options and uses the IOptions<T> parameter of the Startup.Configure method.

Back

Which startup method in ASP.NET Core provides the configuration for the endpoint routing middleware added by the UseRouting method?

Front

app.UseEndpoints()

Back

What does the HttpRequest.Form property do?

Front

Returns a representation of the request body as a form.

Back

Which HttpRequest property returns the verb used for the request?

Front

HttpRequest.Method

Back

In which file (hidden by Visual Studio by default) includes package dependencies and build instructions?

Front

the .csproj file

Back

What HttpRequest property returns the value of the Content-Type header?

Front

HttpRequest.ContentType

Back

What does the HttpRequest.Query property return?

Front

The query string section of the request URL as key/value pairs

Back

In ASP.NET Core, how can cookies be configured when they are created with the Append method?

Front

By using the CookieOptions argument.

 

(ex. Expires, MaxAge, Path, Secure, etc.)

Back

Item template to add a global.json file to a project, specifying the version of .NET Core that will be used

Front

dotnet new globaljson --sdk-version 3.1.101 --output MySolution/MyProject

Back

How do you read aloud the lamba expression character => ?

Front

"goes to"

Back

In ASP.NET Core, why might using Session to maintain application state data be preferable to using cookies?

Front

Cookies are stored at the client where it can be manipulated and used to alter the behavior of the application.

Back

Project template for ASP.NET Core project configured to use the MVC Framework

Front

dotnet new mvc

Back

What does the acronym REST stand for?

Front

Representational State Transfer

Back

What does the HttpContext.User property return?

Front

Details of the user associated with the request

Back

Project template for ASP.NET Core project configured to use Razor Pages

Front

dotnet new webapp

Back

What is the HSTS protocol?

Front

HTTP Strict Transport Security

 

This includes a header in responses telling browsers to only use HTTPS when sending requests to the host, even if the user specifies HTTP.

Back

How can you access request headers in ASP.NET Core?

Front

The HttpRequest.Headers property

Back

What does ASP.NET Core call the sections of a URL path separated by the "/" character?

Front

Segments

Back

CLI command for managing client-side packages

Front

libman

Back

CLI command to remove a package from a project?

Front

dotnet remove package

Back

In ASP.NET Core routing, must segment variables always be separated by the "/" character?

Front

No, they can be separated by any static string.

 

Ex: endpoints.MapGet("files/{filename}.{ext}"...

Back

What are the two ways to add a custom middleware component in ASP.NET Core?

Front

You can use a lambda function (anonymous method?) or a class file.

Back

In ASP.NET Core, what is the difference between middleware components that use next() to invoke the next component in the pipeline, and those that use next.Invoke()?

Front

They are equivalent. Next() is provided by the compiler as a convenience.

Back

Which ASP.NET Core object describes the HTTP request and response, and provides additional context including details of the user associated with the request?

Front

Microsoft.AspNetCore.Http.HttpContext

Back

What is the syntax for Automatically Implemented Properties?

Front

public string Name {get; set;}

 

Same as:

public string Name{

  get { return name; }

  set { name = value; }

}

Back

Which startup method in ASP.NET Core adds the endpoint routing middleware component to the pipeline?

Front

app.UseRouting()

Back

What is the difference between a (forward) proxy and a reverse proxy?

Front

A forward proxy proxies in behalf of clients (or requesting hosts), a reverse proxy proxies in behalf of servers

Back

What does the HttpRequest.Path property return?

Front

The path section of the request URL

Back

CLI commands to add a new project to a solution

Front

dotnet sln MySolution add MySolution/MyProject

Back

What does the HttpRequest.ContentLength property return?

Front

The value of the Content-Length header

Back

Which ASP.NET Core middleware component enforces the use of HTTPS?

Front

app.UseHttpsRedirection()

 

which generally appears near the start of the request pipeline so that redirection to HTTPS occurs before any other component can short-circuit the pipeline and produce a response using regular HTTP.

Back

What is a reverse proxy?

Front

A reverse proxy is a type of proxy server that retrieves resources on behalf of a client from one or more servers. These resources are then returned to the client, appearing as if they originated from the proxy server itself.

Back

Which file keeps track of the packages added to a project?

Front

The Project (.csproj) file

Back

Which two methods add the routing middleware in ASP.NET Core?

Front

UseRouting

UseEndpoints

Back

What does the HttpContext.Connection property return?

Front

A ConnectionInfo object that provides information about the network connection underlying the HTTP request, including details of local and remote IP addresses and ports.

Back

What does the IApplicationBuilder method UseEndpoints do?

Front

It defines the routes that match URLs to endpoints.

Back

What are ASP.NET Core View Components?

Front

A C# class that provides a small amount of reusable application logic with the ability to select and display Razor partial views.

Back

Which method in Program.cs is invoked when the application is executed (and is known as the application's entry point)?

Front

public static void Main(string[] args)

Back

Which Bootstrap class centers the contents of an element and its children?

Front

text-center

Back

What is the difference between ASP.NET Core Views with names that begin with underscores and those that don't?

Front

Views with names that begin with an underscore are not returned to the user, which allows the file name to differentiate between views that you want to render and the files that support them.

Back

Can the ASP.NET Core request pipeline be branched?

Front

Yes, using the IApplicationBuilder methods Map (or MapWhen if you want to use a predicate other than just URL-based conditions)

Back

Which HttpContext property returns details of the user assocated with the request?

Front

HttpContext.User

Back

In ASP.NET Core, upon startup, what does the Main method build?

Front

A host

Back

Which HttpContext property provides access to request features, which allow access to the low-level aspects of request handling?

Front

HttpContext.Features

Back

What does the IApplicationBuilder method UseRouting do?

Front

It adds the middleware responsible for processing requests to the pipeline.

Back

What happens to the request pipeline in ASP.NET Core when a route matches a URL?

Front

The pipeline is short-circuited. The request isn't forwarded to other endpoints or middleware components that appear later in the request pipeline.

Back

Which method of a view component is called when the component is used in a Razor view?

Front

Invoke()

Back

In ASP.NET Core, what is a Catchall Segment Variable used for and how is it denoted?

Front

It allows routes to match URLs that contain more segments than the pattern. It is denoted with an asterisk before the variable name.

 

Ex: endpoints.MapGet("{first}/{second}/{*catchall}", ...

Back

Project template for ASP.NET Core project configured to use Blazor Server

Front

dotnet new blazorserver

Back

What does the Bootstrap class text-center do?

Front

Centers the contents of an element and its children

Back

What is the purpose of a Razor Page's page model class?

Front

It defines handler methods that are invoked for different types of HTTP requests which update state before rendering the view.

Back

What does the HttpRequest.Method property return?

Front

The verb used for the request

Back

Project template with minimum code and content required for ASP.NET Core development

Front

dotnet new web

Back

What does the HttpRequest.Body property return?

Front

A stream that can be used to read the request body

Back

What HttpRequest property returns the value of the Content-Length header?

Front

HttpRequest.ContentLength

Back

In ASP.NET Core, what do you call URL routing segments that match requests using fixed strings (rather than Segment Variables)?

Front

Literal Segments (or Static Segments)

Back

What is the main source of configuration data in ASP.NET Core?

Front

The appsettings.json file

Back

What is the syntax for the Null Coalescing Operator?

Front

?? (e.g var name = p?.Name ?? "<None>";)

Back

In ASP.NET Core's Dependency Injection, what can be used to strike a balance between Singleton Services and Transient Services?

Front

Scoped Services, which shares a resolved service object between all the components handling a single HTTP request.

Back