1.

Explain state management in ASP.NET MVC.

Answer»

The collection of input values(example: city, mobile number, e-mail id, etc.) of a specific web page is called as state of that page. By default, it is not possible to retain the values(states) provided on a single page of a web APPLICATION, when you navigate to another web page. This nature of a web page is known as stateless behaviour.

You can make use of different state management techniques for retaining the values(state) across the web pages. The below-given COMMON state management techniques will be supported by the ASP.NET MVC:

  • Session: It is a state management technique on the server-side that enables you for setting and read the user-specific values when the user navigates through different pages in a web application. These state variables will be stored by default in the host application’s MAIN memory. It is also possible to configure this session variable to store on a SQL server DATABASE. The Session.Clear() method, can be used for removing the session variable from memory.
  • Query String: It is a state management technique on the client-side that is used for storing the values along with URL(Uniform Resource Locator). It cannot be used for storing the composite type values and also for storing confidential data such as passwords, as a query string area will be VISIBLE as part of the URL.
  • Cookies: It is a state management technique on the client-side that stores data in browsers memory. Based on settings, a few browsers may not be able to accept cookies.


Discussion

No Comment Found