Click here to Skip to main content
13,201,452 members (72,023 online)
Click here to Skip to main content
Add your own
alternative version


12 bookmarked
Posted 21 Aug 2007

Share the session objects from Classic ASP to ASP.NET

, 21 Aug 2007
Rate this:
Please Sign up or sign in to vote.
This article simply describes how to share the session objects from Classic ASP to ASP.NET


I want to share session objects from Classic ASP to ASP.NET in our application during the development. I found so many articles in the internet regarding this, some of them are more confusing to me, then I plan to create a new one for my application. Here I am happy to share my code to all of my friends in CodeProject.

The logic behind this session transfer is

Asp Session Variables -> Store in the Database with GUID -> Redirect to the ASP.Net Page with GUID -> Get the Session information from the Database with the received GUID

Points to Remember

In this sample application I have used the following files:

  • SampleAspPage.asp
  • Default.aspx
  • Default.aspx.cs

In the "SampleAspPage.asp" file, I have created two session variables and stored the same in the Database. If we need to communicate database from the ASP application will required a DSN. So before using this we should need to create a DSN with your database settings and update it details to this file.

In the Default.aspx.cs file, we should need to update the database connection string details.

We have to create one table in your database with the following structure for storing the Session informations.

 GUID CHAR(38),   -- The Globally unique identifier
 SessionKey VARCHAR(254), -- The Session value's "name"
 SessionValue VARCHAR(254) -- The Session data
ON ASPSessionState

How to execute Sample Program

Unzip the "" to your wwwroot folder and configure the virtual directory in IIS properly. Execute this application after setting the start page as "SampleAspPage.asp".

Happy Coding to all!


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

RB Changanacherry
Team Leader
India India
I am Rajesh Babu, currently working for Nous Infosystems, Bangalore. I have 6 plus years experience in Microsoft Technologies.

You may also be interested in...


Comments and Discussions

GeneralASPSessionState maintenance Pin
Tchaud017-Apr-09 9:13
memberTchaud017-Apr-09 9:13 
QuestionNon-Internet Explorer Browsers Pin
andresb32130-Sep-07 7:46
memberandresb32130-Sep-07 7:46 
GeneralThis code looks the same ... Pin
Bruno Capuano4-Sep-07 22:21
memberBruno Capuano4-Sep-07 22:21 
GeneralGood Article Pin
rilov21-Aug-07 10:42
memberrilov21-Aug-07 10:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171020.1 | Last Updated 21 Aug 2007
Article Copyright 2007 by RB Changanacherry
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid