Question 67


1.4.2 Question

Multiple Choices

You are creating an ASP.NET MVC 4 web application that will be accessed by a large number of traditional consumers. If you need to be able to access state information on the client side in JavaScript/jQuery, where can you store it? (Choose all that apply.)

  • A. localStorage
  • B. QueryString
  • C. ViewState
  • D. Cookies

Answer:

BD
Explanation
A. Incorrect: localStorage is HTML5 and is not available in all browsers.
B. Correct: Query string information is available across all browsers and is usable on both the client and server.
C. Incorrect: Although ViewState is available in a form field on the page, it is en­crypted and cannot be used on the client side. It is also not used by many ASP.NET MVC 4 constructs.
D. Correct: Cookies can be stored for a period of time on the client and be read from either client- or server-side operations.