C++ C++ C# C# ASP.NET Security ASP.NET Security ASM ASM Скачать Скачать Поиск Поиск Хостинг Хостинг  
  Программа для работы с LPT портом...
Язык: .NET — ©Alexey...
  "ASP.NET Atlas" – AJAX в исполнении Micro...
Язык: .NET — ©legigor@mail.ru...
  "Невытесняющая" Многопоточность...
Язык: C/C++ — ©...
  01.05.2010 — Update World C++: Сборник GPL QT исходников
  15.12.2007 — Весь сайт целиком можно загрузить по ссылкам из раздела Скачать
Хостинг:
Windows 2003, ASP.NET 2.0
бесплатный и от 80 руб./мес


   Отправить письмо
Кулабухов Артем, Беларусь




 Transfering session state between ASP and ASP.NET / Sessions and Session State / ASP. NET

Problem

We need to transfer ASP session state to ASP.NET session state.

Things to consider

  • ASP and ASP.NET sessions are not shareable.
  • We would need something intermediate so that there is minimal rewriting of code.
  • We should be able to uniquely identify each client's session.

Solution

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.