DRAG DROP
You are developing an ASP.NET Web API for a home inventory management system. You
need to limit access to users with IP addresses based only in the United States. You have
the following code:
Which code segments should you include in Target 1 and Target 2 to complete the code?
(To answer, drag the appropriate code segments to the correct targets in the answer area.
Each code segment 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:
TARGET 1: CORRECT!!!
TARGET 2: WRONG!!!
TARGET 2 SHOULD BE AuthorizationContext
https://msdn.microsoft.com/en-us/library/system.web.mvc.authorizeattribute.onauthorization(v=vs.118).aspx#M:System.Web.Mvc.AuthorizeAttribute.OnAuthorization(System.Web.Mvc.AuthorizationContext)
You’re wrong. That’s the MVC namespace which does pass AuthorzationContext. The question specifically states Web API which uses System.Web.Http.AuthorizeAttribute. If you look at the documentation, that does take an instance of HttpActionContext as the parameter to OnAuthorization.
https://msdn.microsoft.com/en-us/library/system.web.http.authorizeattribute(v=vs.118).aspx
target2: WebApi -> HttpActionContext
target2: MVC -> AuthorizationContext