![]() |
Web Development »
Session State »
Sessions and Session State
Intermediate
Transfering session state between ASP and ASP.NETBy r@hu!A simple way to share sessions between ASP and ASP.NET. |
Windows, .NET 1.0, ASP, ASP.NET, Visual Studio, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
We need to transfer ASP session state to ASP.NET session state.
We can use database as the intermediate platform for transferring sessions. Create a table as:
ID |
Key |
Value |
The ID should be unique. We can use Timestamp with IP address or GUID. We can store all session variables in this table as:
For i = 1 to Session.Contents.Count)-1
strSql = Query to insert Session ID, Session.Contents.Key(i),
Session.Contents.Item(i)
cmd.CommandText = strSql
cmd.Execute
Next
Through this code, we can have all our session variables in database. In order to make this generic, we will write this code in a separate page, say Transfer.asp.
Asp page will contain now -> Response.Redirect(Transfer.asp?page=ASPXPage.aspx).
Transfer.asp will have Response.Redirect(ASPXPage.aspx?ID=xxxxx).
The aspx page will retrieve all the variables and put into the session in a similar way. We have passed the GUID as Query String. Not a good idea, I guess.
Hope you all find this useful.
| You must Sign In to use this message board. | ||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 26 Oct 2004 Editor: Sumalatha K.R. |
Copyright 2004 by r@hu! Everything else Copyright © CodeProject, 1999-2009 Web22 | Advertise on the Code Project |