Difference Between ASP Session and ASP.NET Session
Key difference: ASP stands for Active Server Pages. It is commonly known as Classic ASP or ASP Classic. It is a server-side scripting environment that is developed and released by Microsoft. ASP.NET is a server-side Web application framework. ASPX stands for Active Server Pages Extended. It was designed for Web development to produce dynamic Web pages. Both support the context of a session. A session object stores information about, or change settings for a user session. Essentially, it notes everything a user see and does on a page, especially any change that the user may incorporate onto the page.
ASP stands for Active Server Pages. It is commonly known as Classic ASP or ASP Classic. It is a server-side scripting environment that is developed and released by Microsoft. It was Microsoft's first server-side script engine for dynamically generated web pages. ASP was originally released as part of the Windows NT 4.0 Option Pack. It was meant to be an add-on to Internet Information Services (IIS). Since, then ASP has been superseded by ASP.NET, another product by Microsoft.
ASP is mainly used to create and run dynamic, interactive Web server applications. It also allows one to combine HTML pages, script commands, and COM components to create interactive Web pages and powerful Web-based applications. It also makes it easier to develop and modify the said Web applications.
After its original release, there have been two version releases. The ASP 2.0 introduced six built-in objects to the original, which were Application, ASPError, Request, Response, Server, and Session. ASP 3.0 introduced some additional enhancements such as Server.Transfer method, Server.Execute method, and an enhanced ASPError object. Additionally, ASP 3.0 also enabled buffering by default and optimized the engine for better performance. However, as of May 2013 there are no planned upgrades to ASP.
ASP.NET is a server-side Web application framework. ASPX stands for Active Server Pages Extended. It was designed for Web development to produce dynamic Web pages. It is actually the successor to Microsoft's ASP. It was released in January 2002 with the .NET Framework. It is mainly used to build dynamic web sites, web applications and web services.
ASP.NET is built on the Common Language Runtime (CLR). This allows programmers to write ASP.NET code using any supported .NET language. ASP.NET Web pages are also commonly known as Web Forms. They contain static (X)HTML markup. It also contains markup that defines server-side Web Controls and User Controls. This is where developers place all the rc content for the Web page.
In ASP.NET Framework 2.0, a new code-behind model was introduces. This allows static text to remain on the .aspx page, while dynamic code remains in an .aspx.vb or .aspx.cs or .aspx.fs file. The location of the dynamic code depends on the programming language used.
Both support the context of a session. A session object stores information about, or change settings for a user session. Essentially, it notes everything a user see and does on a page, especially any change that the user may incorporate onto the page. This has an advantage, as in case the system crashes in between the changes that the user was trying to make, the changes won’t be lost when the system crashed. The session would keep the memory of where the user left off.
The session is essentially a web page cookie. It stores and retrieves values for a user as the user navigates the webpage. The variables stored in a Session object hold information about one single user, and are available to all pages in one application. Some Common information stored in session variables is name, ID, and preferences. The server creates a new Session object for each new user, and destroys the Session object when the session expires.
Some differences between ASP Session and ASP.NET Session:
- In ASP, the session is Process dependent, whereas in ASP.NET, the session is Process independent.
- In ASP, the session is Cookie dependent, whereas in ASP.NET, the session is Cookie independent.
- ASP session state has no inherent solution to work with Web Farms. ASP.NET session can be stored in state server and SQL SERVER which can support multiple servers.
- ASP session only functions when browser supports cookies, ASP.NET session runs irrespective.
- ASP session state is very heavily dependent on IIS process. If IIS restarts ASP session variables are also recycled. Whereas, ASP.NET session can be independent of the hosting environment thus ASP.NET session can maintained even if IIS reboots.
- ASP session faces server farm limitations. As users move from server to server in a Web server farm, their session state does not follow them. ASP.NET session state has support for server farm configurations. It moves to an out-of-process model, hence it does not face the server farm problem.
Image Courtesy: planet-source-code.com, johnwilliams92.info