Multiple-Page Web Development Flashcards
State Maintanance Summary
- State Maintanance is the process of preserving the state of an end user’s data as he or she navagatres the pages of a Web application.
- We can maintain state on the client, or on the server, or a combination of the two.
- Examples of client side state maintinance are: view state, control state, hidden fields, cookies, and query strings.
Examples of server side state maintinance are: session state, profile properties, database support, and application state.
What are the 3 options for state maintenance?
- Client-based state maintinence: data is retained on the client side.
- Server-based state maintinence: data is retained on the server side.
- Hybrid-state maintinence: a mixture of client and server state maintinence.
What is the view state method?
The view state method automatically preserves the values of the controls on a page (using a structure that resides in the pages source code) so that we can retrieve and use those values after a postback to the server that requests the same page.
View state data is hashed, compressed, encoded, and stored in a structure on the client in the page’s source code.
View state is turned on by default.
Name some of the advantages of using the view state method.
- Since view state data is stored in a page’s source code, it does not require server memory.
- Since view state does not require any special programming, it is easy to implement.
- Since view state data is hashed, compressed, and encoded, it is relatively secure.
16.2 - LIST - Name some of the disadvantages of using the view state method.
Since view state data is stored in a page’s source code:
- large amounts of page data can cause page requests and responses to be relatively slow.
- large amounts of page data can overwhelm the memory of some mobile devices.
- it can be accessed directly by viewing the page’s source code and can thus be tampered with.
What is the cookies state method?
Cookies is a state-maintenance method that permits us to programmatically preserve the values of the controls on a page (using the client’s memory or using a file that resides on the client’s hard drive) so that we can retrieve and use those values on subsequent pages of the application.
There are two types of cookies. Nonpersistent cookies and persistent cookies.
What is the difference between persistent and non persistent cookies?
- Persistent cookies are stored in the browser files on a clients hard drive and will not expire when its associated session terminates.
- Non persistent cookies are stored in the clients memory and expire when its associated session terminates.(when the browser is closed)
Name the advantages of using the cookies state method?
- Since cookie data is stored in the client’s memory or on the client’s hard drive, it does not require server memory.
- Since a cookie contains a simple text-based key-value pair (or set of simple text-based key-value pairs), little processing overhead is required.
Name the disadvantages of using the cookies state method?
- Since most browsers restrict the size of a cookie to between 4,096 and 8,192 bytes, there is a practical limit to how much data can be stored in a cookie.
- Since some end users configure their browsers so that they won’t accept cookies, an application that relies on cookies for state maintenance will not always work properly.
- Since persistent cookie data is stored in a file on the client’s hard drive, it can be accessed directly (by the end user or a hacker) by viewing the contents of the file and can thus be tampered with creating a potential security risk or causing an application malfunction.
What is the query string state method?
Query string is a method that permits us to programatically preserve the values of the controls on a page (using a string that is appended to the pages URL) so that we can retreive and use those values on subsiquent pages.
Name the advantages of using the query string state method.
- Since query string data is passed from one page to another via the page’s URL, it does not require server memory.
- Since a query string contains a set of simple text-based key-value pairs, little processing overhead is required.
- Since virtually all browsers support the use of query strings, they can be used with relative confidence.
Name the disadvantages of using the query string state method.
- Since query string data is passed from one page to another via the page’s URL, it can be seen by the end user and can thus be tampered with creating a potential security risk or causing an application malfunction.
- Since query string data is passed from one page to another via the page’s URL, it can be bookmarked or sent to another person, thus creating a potential security risk.
- Since some browsers restrict the size of an encoded URL, a URL with too much query string data will cause a page malfunction.
What is the session state method?
Session state is a state-maintenance method that permits us to programmatically preserve the values of the controls on a page (using an object that resides in memory on the server) so that we can retrieve and use those values on subsequent pages of the application.
Name the advantages of using the session state method.
Since session state is class based:
- It is familiar to .NET developers and is thus easy to use.
- Session events can be raised and handled during a session.
- Since session-state data is preserved during an Internet Information Services (IIS) restart, session state is very reliable.
- Since session-state data can be preserved in multiple processes and/or on multiple servers, session state can be utilized in Web garden and Web farm environments, thus enhancing an application’s scalability and reliability.
- Since a session ID can be passed via a query string in an encoded URL, session state can work with browsers that do not accept cookies.
Name the disadvantages of using the session state method.
- When a session ID is passed to the server via a query string in an encoded URL, it can be seen by the end user and can thus be tampered with creating a potential security risk or causing an application malfunction.
- When a session ID is passed to the server via a query string in an encoded URL, the URL can be bookmarked or sent to another person, thus creating a potential security risk.
- Since session-state data is stored and maintained in RAM on the server, server performance can degrade as more and more sessions require tracking.