What are three programmatic improvements of ASP.NET over ASP?

There are three programmatic improvements of ASP.NET over ASP are :

  • Ease of deployment
  • Improved session state
  • The use of code declaration blocks

Explain Session state vs View state.

In some cases, using view state is not feasible. The alternative for view state is session state. Session state is employed under the following situations:

Large amounts of data – View state tends tincrease the size of both the HTML page sent the browser and the size of form posted back. Hence session state is used.
Secure data – Though the view state data is encoded and may be encrypted, it is better and secure if nsensitive data is sent tthe client. Thus, session state is a more secure option.
Problems in serializing of objects intview state – View state is efficient for a small set of data. Other types like DataSet are slower and can generate a very large view state.

How to update and retrieve value from a session state object?

To add or update a session state item use the following syntax,
[CODE]Session[“Item Name”]= value;[/CODE]
Ex:- [CODE]Session[“Name”]= Abhisek;[/CODE]
You can also pass a variable.

To retrieve a session state items value use following ,
[CODE]String name=Session[“Name”].ToString();[/CODE]
You can also retrieve to other formats according the session state item’s data.

What are the advantages and disadvantages of using Session State?

The advantages of using session state are:

  • It is easy to implement and is just similar to using View State.
  • Accessing of data is very fast as it stores session data in memory object of the current application domain.
  • It ensures platform scalability and it works in the multi-process configuration.
  • Also it ensures data durability, since the session state retains data even if ASP.NET work process restarts (in outproc session).

The disadvantages of using session state are:

  • As the session state data is stored in server memory, it is not advisable to use session state when you are working with large sum of data.
  • With the use of Session state, it will affect the performance of memory, because session state variable stays in memory until you destroy the state.
  • If the worker Process or application domain recycles all session data will be lost.
  • We can’t use it in web Garden scenarios and is not suitable for web farm scenarios also.

What are the different states in ASP.NET?

  • view state
  • session state
  • application state

Differences of ASP and ASP.NET Session State


  1. ASP ‘s Session State was stored in the same process that hosts ASP.
  2. for different web servers, each Web server had its own session state. There was a problem in sharing session states in a web farm situation.
  3. No support for Cookieless sessions.
  4. No web.config files for configuring the session state.


  1. ASP.NET ‘s Session State is stored in the same process that hosts ASP.net(default) It can also be stored out of process in an sql server database or a state server
  2. different web servers can easily share the session state using the appropriate configurations.
  3. Supports Cookieless sessions.(<sessionState cookieless=true/>) in web.config file.
  4. SessionId is visible in the browser.
  5. uses web.config files for configuring the session state.

How to disable a session state?

Disable a session state for those pages which are not require session state, then disable session on that particular pages using following line.

<%@ Page EnableSessionState=”False” %>