0 like 0 dislike
8 views
by

What are the ways of preserving data on a Web Form in ASP.NET?

1 Answer

0 like 0 dislike
by

ASP.NET has introduced view state to preserve data between postback events. View state can't avail data to other web form in an application. To provide data to other forms, you need to save data in a state variable in the application or session objects.

Define application state variable and session state variable.

These objects provide two levels of scope:

Application State
Data stored in the application object can be shared by all the sessions of the application. 

What are the ways of preserving data on a Web Form in ASP.NET?

ASP.NET has introduced view state to preserve data between postback events. View state can't avail data to other web form in an application. To provide data to other forms, you need to save data in a state variable in the application or session objects.

Define application state variable and session state variable.

These objects provide two levels of scope:

Application State
Data stored in the application object can be shared by all the sessions of the application. Application object stores data in the key value pair.

Session State
Session State stores session-specific information and the information is visible within the session only. ASP.NET creates unique sessionId for each session of the application. SessionIDs are maintained either by an HTTP cookie or a modified URL, as set in the application’s configuration settings. By default, SessionID values are stored in a cookie.

Describe the application event handlers in ASP.NET?

Following are the application event handlers:

Application_Start:
This event occurs when the first user visits a page of the application.

Application_End:
This event occurs when there are no more users of the application.

Application_BeginRequest:
This occurs at the beginning of each request to the server.

Application_EndRequest:
Occurs at the end of each request to the server.

Session_Start:
This event occurs every time when any new user visits.

Session_End:
Occurs when the users stop requesting pages and their session times out.

Welcome to NETRAANSWERS.COM, where you can ask questions and receive answers from other members of the community.
...