Design the application architecture - Objective 1.4: Configure state management Flashcards Preview

Exam 70-486: Developing ASP.NET MVC 4 Web Applications > Design the application architecture - Objective 1.4: Configure state management > Flashcards

Flashcards in Design the application architecture - Objective 1.4: Configure state management Deck (27)
Loading flashcards...
1
Q

What 6 places can you store state information in an ASP.Net MVC application?

A
  1. Cache
  2. Session
  3. Cookies
  4. QueryString
  5. [Http]Context.Items
  6. Profile
2
Q

What is the ASP.Net Cache?

A

A memory pool store on the server and shared across users

3
Q

What is the ASP.Net Session?

A

A store on the server that is unique for each user

4
Q

What are cookies?

A

Strings that are stored locally in the browser’s cache and are sent with each HTTP request to the server

5
Q

What is the QueryString?

A

The part of the URL after the question mark

6
Q

What is the HttpContext.Items?

A

A place to store data which is needed only for the lifetime of the request

7
Q

What is ASP.Net profile?

A

User-specific information stored in a database which persists across multiple sessions

8
Q

What is a major consideration of using ASP.Net Cache in a web farm?

A

Each server needs its own copy of the Cache since any individual request cannot be guaranteed to be sent to a specific server.

9
Q

Which class must you inherit from to implement a custom session state provider in ASP.Net, for example, one that stores session in an Oracle database,?

A

SessionStateStoreProviderBase

10
Q

How do you configure IIS to support a custom session state provider?

A
  1. Open IIS Manager and navigate to the web site.
  2. In Features View, double-click Session State.
  3. On the Session State page, in the Session State Mode Settings area, click Custom.
  4. Click Apply in the Actions pane.
11
Q

What are cookies?

A

Small snippets of information stored on the client side that can persist across sessions and are individualized to a particular domain or subdomain.

12
Q

When are cookies sent to and from a server?

A

They are sent to and from a server with every request and response.

13
Q

In ASP.Net, which class is used to read incoming cookies on the server?

A

HttpContext.Request.Cookies

14
Q

In ASP.Net, which class is used to write outgoing cookies on the server?

A

HttpContext.Response.Cookies

15
Q

What is a query string?

A

Information passed as part of the URL. The query string part of the URL is any text after the question mark.

Ex:

Given this url - http://www.microsoft.com/?id=20

The query string is id=20.

16
Q

In ASP.Net, which class is used to read the query string sent during a request?

A

HttpContext.Request.QueryString

17
Q

Why should you not put personal or information that should be secure in the query string?

A

Query strings/URLs are not encrypted even over SSL.

18
Q

Where is HttpContext.Items most commonly written to?

A

In HTTP modules, such as during the authentication phase of a request.

19
Q

In ASP.Net, which class is used to read user profile information?

A

HttpContext.Profile

20
Q

What must be configured in the web.config before ASP.Net user profiles can be used?

A

A membership and a profile provider

21
Q

What is the maximum size cookies can be?

A

4 KB

22
Q

What is one advantage of using cookies over HTML5 web storage for maintaining state?

A

With cookies, no additional code needs to be written since cookies are automatically sent/received during requests.

23
Q

What two JavaScript objects are used to access HTML5 web storage?

A

sessionStorage and localStorage

24
Q

What is the difference between HTML5 session storage and local storage?

A

Local storage persists after the browser closes. Session storage persists only while the window or tab is still open.

25
Q

In ASP.Net, how do you determine the capabilities of the current user’s browser?

A

Access the HttpRequest.Browser property which returns an HttpBrowserCapabilities object.

26
Q

In JavaScript, how do you determine if the browser supports HTML5 web storage?

A

Test the window object for the presence of the localStorage or sessionStorage properties.

Ex:

if (window.localStorage)
{
window.localStorage.setItem(“MyKey”, “MyValue”);
}

27
Q

In JavaScript, how do you determine if HTML5 web storage has been updated?

A

Add an event listener for the storage event of the window object.

Ex:

window.addEventListener(“storage”, myEventHandler, true);