最新的Microsoft Developing ASP.NET MVC 4 Web Applications - 70-486免費考試真題

問題1
You need to ensure that new customers enter a valid email address.
Which code should you use? (Each correct answer presents part of the solution. Choose all that apply.)

正確答案: B,D
問題2
Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some questions sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen.
You are developing an ASP.NET Core MVC web application.
The application must be exposed to external users over ports 80 and 443 and must meet the following requirements:
Handle more than 1024 simultaneous connections.
Support Windows authentication.
Support HTTP/2 over TLS.
Include response caching.
Protect against denial-of-service attacks.
You need to deploy the application to an on-premises web server.
Solution: You deploy the application to a Windows server that runs Kestrel with a default Nginx reverse proxy.
Does the solution meet the goal?

正確答案: B
問題3
You are developing an application that uses ASP.NET Core Identity for authorization. The application must use an existing Microsoft Azure Table Storage instance to store user information. You create a custom UserStore class.
You need to register the class as a dependency.
Which two interfaces should you implement? Each correct answer presents part of the solution.
NOTE: Each correct selection is worth one point.

正確答案: D,E
說明:(僅 VCESoft 成員可見)
問題4
You are developing an ASP.NET MVC application that will be hosted on Microsoft Azure. The application includes the StackExchange.Redis client package. A variable named CacheConnectionConfiguration stores the cache endpoint URL and the password to connect to the cache.
The application must store a user's color selection by using the Azure Redis cache. The cached value must expire after 90 minutes. You need to cache the user's color selection.
How should you complete the relevant code? To answer, choose the appropriate code segment from each list in the answer area.
正確答案:

Explanation:
Box 1: var cache = connection.GetDatabase():
Once the connection is established, return a reference to the redis cache database by calling the ConnectionMultiplexer.GetDatabase method.
Box 2: cache StringSet("color", colorSelection,TimeSpan.FromMinutes(90)); The TimeSpanFromMinutes method returns a TimeSpan that represents a specified number of minutes, where the specification is accurate to the nearest millisecond.
Example: The following code snippet shows how to set an expiration time of 90 minutes on a key.
// Add a key with an expiration time of 90 minutes
await cache.StringSetAsync("data:key1", 99, TimeSpan.FromMinutes(90));
References: https://docs.microsoft.com/en-us/azure/redis-cache/cache-dotnet-how-to-use-azure-redis-cache
https://msdn.microsoft.com/en-us/library/system.timespan.fromminutes(v=vs.110).aspx
問題5
You need to configure session storage in the web.config file to meet the technical requirements for scalability.
Which SessionState mode should you use? (Each correct answer presents a complete solution. Choose all that apply.)

正確答案: A,D
問題6
You are developing an ASP.NET MVC application. The application uses a set of custom exceptions to log errors that occur during the execution of an action.
You need to develop a class that implements logging.
Which interface should you implement?

正確答案: C
說明:(僅 VCESoft 成員可見)
問題7
You are developing an ASP.NET MVC application. The application includes the following code. Line numbers are included for reference only.

You add the following markup to the system.web section of the web.config file:

For each of the following statements, select Yes if the statement is true. Otherwise, select No.
正確答案:
問題8
You are developing an ASP.NET MVC application. You plan to use OAuth to authenticate users to the application.
You need to use the correct authentication data in the application.
What should you do? To answer, drag the appropriate data element to the correct location or locations. Each data element may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.
正確答案:

Explanation:
Live Connect implements the OAuth 2.0 protocol to authenticate users.
In the authorization code grant flow, the client makes authorization requests by using request_type=code.
The following diagram illustrates how the authorization code grant flow works.

1. The client starts the flow by directing the resource owner's user agent to the Live Connect authorization endpoint, by using a URL in the following format.
https://login.live.com/oauth20_authorize.srf?client_id=CLIENT_ID&scope=SCOPES&response_type=code&redirect_uri=REDIRECT_URI
2. The authorization server authenticates the resource owner via the user agent, and establishes whether the resource owner grants or denies the client's access request.
3. Assuming that the resource owner has granted access, the Live Connect authorization server redirects the user agent to the client by using the redirection URI that was provided in the initial request.
4. The user agent calls the client with the redirection URI, which includes an authorization code and any local state that was provided by the client. For example: http://contoso.com/Callback.htm?code=AUTHORIZATION_CODE.
5. The client requests an access token from the authorization server's token endpoint by using its client credentials for authentication, and includes the authorization code that was received in the previous step.
6. If the credentials are valid, the authorization server responds by returning an access token.
References: https://msdn.microsoft.com/en-us/library/hh243647.aspx