Which of the following states is a server-side technique that uses the Web server to store data?

Which of the following states is a server-side technique that uses the Web server to store data?

Which of the following states is a server-side technique that uses the Web server to store data?

A.
Session State

B.
View State

C.
Application state

D.
Control State

Explanation:
An application state is a server-side technique that uses the Web server to store data. Application
state is a collection of user-defined variables that are shared by an ASP.NET application. These are
set and initialized when the Application_OnStart event fires on the loading of the first instance of the
application and are available till the last instance exits. Application state variables are accessed using
the Applications collection, which provides a wrapper for the application state variables. Application
state variables are identified by names.
Answer B is incorrect. View state refers to the page-level state management mechanism, which is
utilized by the HTML pages emitted by ASP.NET applications to maintain the state of the Web form
controls and widgets. The state of the controls is encoded and sent to the server at every form
submission in a hidden field known as VIEWSTATE. The server sends back the variable so that when
the page is re-rendered, the controls render at their last state. At the server side, the application
might change the View state, if the processing results in updating the state of any control. The states
of individual controls are decoded at the server, and are available for use in ASP.NET pages using the
ViewState collection.
The main use of this is to preserve form information across postbacks. So if a user fills out a form but
enters a wrong value, the form is automatically filled back in when the page is sent back to the user
for correction. View state is turned on by default and normally serializes the data in every control on
the page regardless of whether it is actually used during a postback. This behavior can (and should)
be modified, however, as View state can be disabled on a per-control, per-page, or server-wide
basis.
Answer A is incorrect. Session state is a collection of user-defined session variables, which are
persisted during a user session.
These variables are unique to different instances of a user session, and are accessed using the
Session collection. Session variables can be set to be, even if the session does not end. At the client
end, a user session is identified either by a cookie or by encoding the session ID in the URL itself. By
default, ASP.NET Session state is enabled for all ASP.NET applications.
ASP.NET supports the following three modes of persistence for session variables:
1.In Process mode
2.ASPState mode
3.SqlServer mode
Answer D is incorrect. Control state is like View state but functionally independent. Control state
retains control property
information during multiple round trips to the server. The control state data is specific to a custom
control and is retained even if the View state is disabled at the page level.
Control state cannot be disabled and it is designed for storing a control’s necessary data that must
be available on postback to enable the control to function even when View state has been disabled.
By default, the ASP.NET page framework stores Control state in the page in the same hidden
element in which it stores View state. Use Control state only for small amounts of critical data that
are necessary for the control across postbacks. Do not use control state as a substitute to View state.



Leave a Reply 0

Your email address will not be published. Required fields are marked *