Sharing session value between ASP and ASP.NET

xiaoxiao2021-03-06  73

Although Microsoft has worked hard to make ASP and ASP.NET could not costly coexist, there is still a place to be a stumbling block ----- session. Fortunately, ASP.NET has made more obvious improvements in session processing, making it impossible to pass traditional session values. Net this problem is not so obvious. Unfortunately, this method is not very simple. In the process of trying to find a suitable solution, I have encountered two good ways, here. The first is to store the SESSION's value in the Hidden INPUT of a traditional intermediate page, and then submit the value of this page to a .NET's intermediate page, which will store the value in the Form. This is a simple and effective way, but it can't be used in turn. Because you can't tell which page you submitted in .NET. Each page can only postback to this page. The second method may seem to have a relatively practical approach. Microsoft's Billy YUEN has made an effective

method. Although its code is first-class, there is no obvious vulnerability in whole, but in my own system, it doesn't work. :( Of course, if this thing is useful to you, you don't have to continue to see me. Thank you, browse :) If you decide to continue to read, then I will simply talk about my method. First, it needs a database, which Category can be. (However, the code here is written for SQL Server) When a page needs to be relocated to another page, the two pages are used as ASP and ASP.NET, then two intermediate pages are generated. . The intermediate page responsible for collecting source data will save the session in the ASP page and the session in the ASP.NET to a tuple of the database so they can share the GUID of a database, which is because of the traditional ASP and .NET Using different sessionID formats, so we don't use SessionID to use the database recorded GUID. The middle page of collecting source data will pass the GUID to the intermediate page of the sending data through a querystring. The intermediate page of the sending data will read the value of the two parties through the database, and the SESSION mode can be identified by the target page, and then clear Corresponding records are repositioned to the target page. This method supports two-way transformation. Installation steps: 1. Run the aspsessionState.sql script on your SQL Server 2. Copy all .asp and .aspx to a folder in your site 3. Modify in SessionTransfer.asp and SessionTransfer.aspx.cn Connect the content of the connection database in the file. 4. Compile the ASPX file: Use in the hyperlink or redirect, the format is as follows from the ASP page to the ASP.NET page sessionTransfer.asp? DIR = 2ASPX & URL =

From the ASP.NET page to the ASP page sessionTransfer.aspx? DIR = 2ASP & URL =

Code download

http://www.asp101.com/articles/sidney/sharingsessionState/Session_Transfer.zip

转载请注明原文地址:https://www.9cbs.com/read-87011.html

New Post(0)