Click here to Skip to main content
Click here to Skip to main content
Go to top

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

Introduction

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.

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

How to execute Sample Program

Unzip the "SessionSharing.zip" 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!

License

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

Share

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.

Comments and Discussions

 
GeneralASPSessionState maintenance PinmemberTchaud017-Apr-09 9:13 
QuestionNon-Internet Explorer Browsers Pinmemberandresb32130-Sep-07 7:46 
GeneralThis code looks the same ... PinmemberBruno Capuano4-Sep-07 22:21 
GeneralGood Article Pinmemberrilov21-Aug-07 10:42 

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

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

| Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 21 Aug 2007
Article Copyright 2007 by RB Changanacherry
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid