Errata

Exam Ref 70-486: Developing ASP.NET MVC 4 Web Applications

Errata for Exam Ref 70-486: Developing ASP.NET MVC 4 Web Applications

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Page 1
Listing 2-5

In Chapter 2- Listing 2-5- page 98

[DataType(DataType.Date)] data annotation
attribute is assigned to an integer data type field:

[DataType(DataType.Date)]<---- Bad!!!
[Range(300, 3000)]
public int NumberOfAuthors { get; set; }

[Required]
public Datetime CreateDate { get; set; }

....
while it should be assigned to DateTime data type

[Range(300, 3000)]
public int NumberOfAuthors { get; set; }

[Required]
[DataType(DataType.Date)]<----Good!!!
public Datetime CreateDate { get; set; }

DenysC  Dec 13, 2013 
PDF Page 23
Listing 1-5

Code listing 1-5 on page 23 refers to using the HttpService class (no namespace listed), but a search of classes in the .NET framework does not return this class. Traditionally using Web API you would choose to use the System.Net.Http.HttpClient class.

If also tried importing the Nuget package for Web Api (currently v 2.1) and it doesn't include an HttpService class.

If HttpService needs to be pulled in a special fashion it should be documented in the chapter.

Anonymous  Mar 10, 2014 
PDF Page 30
Question #2

Answer B "Create an HttpService and connect using Get(URL)" is not a valid answer to question #2.

The ASMX will return a SOAP response - and the HttpService example on page 23 clearly refers to this approach as "Using the HttpService class to get output from a ***REST URL***"

The traditional way to consume an ASMX web service is by creating a proxy class. Refer to page 22 "Consuming a web service in ASP.NET MVC 4 in Visual Studio is as simple as using the Add
a Service Reference command."

Thanks.

Anonymous  Mar 10, 2014 
PDF Page 38
More Info

The link is not working anymore. "This topic is no longer available"

Ibrahem Khalil  Dec 22, 2013 
PDF Page 38
More Info/Windows Azure Web Role section

The link in this section is a combination of a link to the e-book file location and the actual web URL. For instance it reads file:////D|Documents/%20http://msdn.microsoft.com/en-US/library/gg432976.aspx. If I extract the actual link out of the extended URL the MS site shows a "
This topic is no longer available" page.

Anonymous  Mar 15, 2014 
PDF Page 47
First web.config example

The sample is for an InProc sessionState - but shows the configuration of a SQL Server database inside the sessionState section. According to MSDN InProc Session state is *in process* with an ASP.NET worker process, therefore not needing a SQL Connection string. I'm not sure if this throws an exception, but at a minimum it is misleading/confusing.

Anonymous  Mar 15, 2014 
PDF Page 50
4th bullet point

The quote "ASP.NET MVC 4 does not have any default handlers to work with the client-side information other than the jQuery library." is not clear. What is a default handler in this context? Why is jQuery included? If we are discussing client-side data access, why leave regular JavaScript out? Please clarify thanks.

Also there is an extra period after the word "but"

Anonymous  Mar 15, 2014 
Other Digital Version 51
Estados Unidos

Questions related to Objective 1.4
(Kindle position 1256)
Question 2
(A) localStorage is a valid answer. Just we have to implement checking mechanism as you mentioned in the lecture.

Question 3.
(C) is also valid... by default Session Store Provider is inProc, to guarantee 100% sessionless application we have to disable it in Web.Config

Jaider Ariza  Mar 04, 2014 
PDF Page 56
Manifest

The example of the manifest file:
The "CACHE MANIFEST" line should be formated correctly to be just up the "# Cached entries." comments. Otherwise, some readers won't pay attention to that line. It's very important line and must be the first line.

Also, the explanation of FALLBACK needs more clarification as the following:
FALLBACK The last section enables you to specify substitute files that you might not want cached for whatever reason but would like something to be used in their place. The URL on the left side is substituted by the one on the right. In this example, button.png should be replaced by a default offline-button.jpg image.

Ibrahem Khalil  Dec 23, 2013 
PDF Page 59
Question no. 2

Correct answer mentioned in book is B,C but it should be only B.
Read first paragraph in objective summary of this chapter it is clearly mentioned:
Donut hole caching enables a majority of the page to be dynamic and caches some content.

so correct answer should be B

Anonymous  Jan 18, 2014 
PDF Page 59
Question no. 3

Correct answer mentioned in book is A,C,D
I agree on A,C but not D
because AppFabric caching comes into picture in case of webfarm but in question no webfarm word is used.
Could you please explain me about answer D

Anonymous  Jan 18, 2014 
Printed Page 67
Question 3

page 67 states:
What is the first request sent to start HTTP polling?

I think according to the answer, that this should be :

What is the first request sent to start *WebSockets*?

Anonymous  Dec 17, 2013 
PDF Page 84
1.7, Answer of qu. 2

None of the choices is correct.
"MapRequestHandler" is raised after the appropriate HttpHandler is selected to respond to the request. So we cannot redirect the request to a different handler; than is in the routing table, in that event.

The right answer is to handle the "PostResolveRequestCache" event "ASP.NET Routing"

ASP.NET routing is a request-dispatching mechanism that lets us associate a certain URL with a handler that can process requests made to that URL. This association is done by registering the "routes" that define which handler to invoke for a particular URL path. When a request is made to a Web server ASP.NET routing looks up the requested URL path in the list of registered routes. If the route is found, the corresponding handler for that route is invoked to process that request.

ASP.NET routing is implemented as a managed-code module that plugs into the IIS request-processing pipeline at the Resolve Cache stage (PostResolveRequestCache event) and at the Map Handler stage (PostMapRequestHandler event). ASP.NET routing is configured to run for all requests made to the Web application.

During the PostResolveRequestCache event, the module looks through a routing table (a collection of route objects) for a route that matches the requested URL path. If a match is found, the module obtains a reference to the handler that corresponds to that route and saves the reference as part of the current HTTP context. A handler can be any .NET Framework object that implements the System.Web.IHttpHandler interface. If no route is found, the module does not do anything, and the URL falls through and is processed normally (typically by matching it to a file on disk).

During the PostMapRequestHandler event, the module checks if the HTTP context contains any information about a handler. If it does, ASP.NET routing uses the information to set the Handler property of the current HTTP context. This ensures that during the Execute Handler stage, IIS will execute the handler that was selected by the routing module. If that information is not set, then the module does not do anything and the URL falls through to let IIS make a handler selection.

Ibrahem Khalil  Dec 23, 2013 
PDF Page 86
4th paragraph

"A base template inherits the System.Web.Mvc.ViewMasterPage namespace". ViewMasterPage is a class, not a namespace.

Anonymous  Mar 17, 2014 
PDF Page 86
Last code sample on the page

The book states:

A base template inherits the System.Web.Mvc.ViewMasterPage namespace, regardless of view engine, as shown by the main tag in _Layout.cshtml:

<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>

However _Layout.cshtml does not have a tag like this - look at the following page (Listing 2-1 on 87) for a sample _Layout.cshtml - without this tag. I believe this is from a Site.Master file.

Anonymous  Mar 17, 2014 
PDF Page 102
2nd paragraph

Reg. JsonRequestBehavior.AllowGet enum:

It's NOT for "which ensures that if the user accepts the returned value, the validation will not run again"
By default, the ASP.NET MVC framework does not allow us to respond to an HTTP GET request with a JSON payload. If we need to send JSON in response to a GET, we will need to explicitly allow the behavior by using JsonRequestBehavior.AllowGet as the second parameter to the JSON method. However, there is a chance a malicious user can gain access to the JSON payload through a process known as JSON Hijacking. So we usually do not return sensitive information using JSON in a GET request (not applicable with this example).

Ibrahem Khalil  Dec 23, 2013 
PDF Page 103
web.config code snippet (and the preceding parahraph)

That snippet is required for all automatic client validations of model-based data annotations; not only for remote validation.
Please, mention that in the preceding paragraph. That snippet should be shared between the two sections "Views" and "Using Remote Validation".

Ibrahem Khalil  Dec 23, 2013 
PDF Page 104
The 3 "Sample of JavaScript code" in all current section

extra 'var' before
Contact.prototype.bindEvents
Contact.prototype.toggleEmail
menu.prototype.bindEvents
menu.prototype.toggleSubMenu

Also, in the first sample of code, there is missing ' after li.email
var Contact.prototype.bindEvents = function() {
$('ul.menu').on('click', 'li.email, $.proxy(this.toggleEmail, this));
};

Also, undefined content should be commented, like:
this.additionalEvents(); // additional events such as DOM manipulation etc
so in copy and paste, no problems.

Ibrahem Khalil  Dec 23, 2013 
PDF Page 117
Sample of C# code

@Html.TextBox("",

The first parameter is required and cannot be empty as it' used for the id and name attributes. An exception will be thrown.

That is required for binding the user input to the model properties when posting back.

Also, EditorFor can be used in that custom editor templates.

For sure you already know all of that information, but many readers, especially beginners won't be able to know that.

Ibrahem Khalil  Dec 24, 2013 
PDF Page 165
AuthorizeAttribute Paragraph

Last sentence : Authorize(Roles = Admin,PowerUser).

Missing double quotes the list of roles ->
Authorize(Roles = "Admin,PowerUser").

Ibrahem Khalil  Dec 25, 2013 
PDF Page 175
Objective 3.4: 1st paragraph

Last word in 1st sentence, should be controller instead of method.

Ibrahem Khalil  Dec 25, 2013 
PDF Page 194

Missing }

routes.MapRoute(
"Home",
"{controller}/{action}",
new { controller = "Home", action = "Index"
).RouteHandler = new MyCustomRouteHandler ();

Ibrahem Khalil  Dec 25, 2013 
Printed Page 196, 197
Ansers for question 2

On page 196 and 197 the answers A and B for question 2 are identical.

The solution to these answers on page 211 and 212 are slightly off from
these answers.

Anonymous  Dec 17, 2013 
PDF Page 229
2ns code sample

Contract.Results<Article>() != null);

It's supposed to be
Contract.Results<Article>() != null);

Result is without s

Ibrahem Khalil  Dec 29, 2013 
PDF Page 267
Objective 4.2: Qu 3

Option D
"The custom error mode is set to mode=?LocalOnly?, which means that
users will not see the actual error pages."

"LocalOnly" is not a valid value...

Ibrahem Khalil  Dec 26, 2013 
PDF Page 309
Sample of C# code section

In the example there are multiple lines that could be better or could cause problems.

For setting the newIdenty object, the token is casted to MyCustomToken. However, prior to the if statement changing the Validity of the signature, the exact same cast was executed. so mycustomtoken could be re-used.

And when adding the newIdentity to the Claims collection, the Add method is called outside of the validation if statement, in which the newIdentity is created. Therefore the code will not compile, since newIdentity might not be created when adding to the collection. It should be moved in the if statement.

Gert-Jan Admiraal  Jan 20, 2014 
PDF Page 322
MORE INFO

The link is broken.

Ibrahem Khalil  Dec 27, 2013 
Printed Page 334
last line of Sample of C# code

paarm.Value = submittedId;

"paarm" is misspelled and should rather be "param"

param.Value = submittedId;

DenysC  Jan 15, 2014 
PDF Page 337
Last bullet

Last sentence. Missing Token in the method name AntiForgery

Ibrahem Khalil  Dec 27, 2013 
PDF Page 342
Objective 5.2 Review: qu 1

Both:
[Authorize(Roles="Admin")]
[AuthorizeAttribute(Roles="Admin")]

Are correct answers and both are proper way to be used like that!!!

Ibrahem Khalil  Dec 27, 2013 
PDF Page 345
Qu 3

Options B and D explanation. Is web.config is a valid value for web.config ???????!!!!!

Ibrahem Khalil  Dec 27, 2013