ASP3和ASP.NET会话共享 [英] ASP3 And ASP.NET session sharing

查看:159
本文介绍了ASP3和ASP.NET会话共享的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有分享ASP3和ASP.NET之间的会话的方式?

Is there a way to share the session between ASP3 And ASP.NET?

感谢

推荐答案

尽管如此,使ASP和ASP.NET共存毫不费力微软尽了最大努力,一个区域仍然是一个绊脚石......会话状态。幸运的是ASP.NET的升级会话状态管理的优点远大于不能够经典的会话信息传递到.NET的不便。不幸的是,没有简单的解决办法;我可以提供最多的是一个容易实现的解决方法。

Despite all of Microsoft's best efforts to make ASP and ASP.NET coexist effortlessly, one area remains a stumbling block... session state. Fortunately the advantages of ASP.NET's upgraded session state management far outweigh the inconvenience of not being able to pass "Classic" session information to .NET. Unfortunately there is no simple solution; the most I can offer is an easy to implement workaround.

在试图寻找一个合适的分辨率,我遇到两个可值得一提的不错的选择。首先需要解析的会话信息到隐藏表单域经典中间页,然后提交该页面加载表单字段到会话状态的.NET中间页。这是一个很好的,简单的解决方案,但它不工作两者兼得。在.NET中不能指定您提交页面。每个页面有回发到自己。

In trying to find a suitable resolution, I've come across two good options that are worth mentioning. The first involves parsing the session information out to hidden form fields on a "Classic" intermediate page and then submitting the page to a .NET intermediate page that loads the form fields into the session state. This is a good, simple solution, however it doesn't work both ways. In .NET you cannot specify the page that you submit to. Each page has to PostBack to itself.

第二个选项是可能不是一个解决方法更接近实际的解决方案。比利源在微软开发了一个有效的解决方案。在code是优雅,融合似乎是无缝的,但我不能让它在我的系统上工作(记得我说,有没有简单的解决方案,而不是有没有解决方案)。如果该解决方案适用于您,太棒了!你不会需要我的code,你会从经典愉快地传递会话信息.NET像它会不时兴了,感谢停止了。

The second option is probably closer to an actual solution than to a workaround. Billy Yuen at Microsoft has developed an effective solution. The code is elegant, the integration appears to be seamless, but I couldn't get it to work on my system (remember I said that there was no simple solution, not that there was no solution at all). If this solution works for you, great! You won't need my code and you'll be happily passing session information from "Classic" to .NET like it's going out of vogue, thanks for stopping by.

好吧,如果你还在读书让我简要介绍一下我创建了解决方法。它需要一个数据库,但是这并不重要哪种类型的数据库(虽然code为用于SQL Server写入)。当一个页面(源页)要重定向到另一页(目标页),使用不同版本的ASP,它会调用一个中间页。该人士中间页面需要每个会话变量,并将其与一个全局唯一ID(GUID)一起添加到数据库中。由于经典和.NET使用不同的SessionID格式是无法使用的SessionID,因此,使用一个GUID的。该人士中间页,然后通过一个查询字符串变量GUID到目的地中间页。目的地中间页从数据库检索会话信息,经过自己清理,然后重定向到目标页面。它类似于第一种解决方法,但支持双向传输状态。
code用途
安装

Ok, if you're still reading let me briefly describe the workaround I've created. It requires a database, but it is not important which type of database (though the code is written for SQL Server). When a page (source page) wants to redirect to another page (destination page) that uses a different version of ASP, it calls an intermediate page. The source intermediate page takes each session variable and adds it to the database along with a Globally Unique ID (GUID). Since "Classic" and .NET use different SessionID formats it is not possible to use SessionID, hence the use of a GUID. The source intermediate page then passes the GUID to the destination intermediate page through a Querystring variable. The destination intermediate page retrieves the session information from the database, cleans up after itself, and then redirects to the destination page. It's similar to the first workaround, but supports transferring state in both directions. Code Usage Installation


  1. 将举行临时会话信息的数据库上运行的ASPSessionState.sqlSQL查询。

  2. *(SessionTransfer.aspx和SessionTransfer.aspx.cs)文件复制的.asp和的.aspx,到一个文件夹在您的网站。

  3. 在SessionTransfer.asp和SessionTransfer.aspx.cs文件更新连接对象的信息。它坐落在每个文件中三个地方(抱歉没有巩固的连接信息)。

  4. 编译ASPX文件。

  5. 将.asp和的.aspx。*文件都必须驻留在同一个文件夹中工作。

用法

有关在超链接(锚标记)使用或Response.Redirect的,设置目标网址为以下之一:

For use in a Hyperlink (Anchor Tag) or a Response.Redirect, set the destination URL to be one of the following:

从ASP经典页:

SessionTransfer.asp?dir=2aspx&url=<asp_dotnet_url>

从ASP.NET页:

From an ASP.NET page:

SessionTransfer.aspx?dir=2asp&url=<asp_classic_url>

在code将传递会话信息将用户重定向到或由指定的URL。
下载

The code will transfer the Session information and Redirect the user to the url specified by or . Download

您可以从这里下载code :session_transfer.zip(4.6 KB)。

You can download the code from here: session_transfer.zip (4.6 KB).

这篇关于ASP3和ASP.NET会话共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆