添加Classic ASP Application的功能

时间:2022-06-16 05:10:41

I will be adding new pages and adding functionality to current pages. I would basically like to use new technology and but I don't know how should I add it to classic ASP pages

我将添加新页面并向当前页面添加功能。我基本上想使用新技术,但我不知道如何将它添加到经典的ASP页面

In other words, can I <#--include--> an aspx page in Classic asp page? Or anything of that sort, may be creating a user control in ASP.NET and using it in classic ASP?

换句话说,我可以<# - include - >经典asp页面中的aspx页面吗?或者任何类似的东西,可能是在ASP.NET中创建用户控件并在经典ASP中使用它?

2 个解决方案

#1


6  

You shouldn't really add it to the existing classic ASP pages. You may want to perform a full (yet slow) migration from classic ASP to .Net. Otherwise, you may just simply want to add your new functionality in new pages completely. If you have a templated site, this may become a litle cumbersome because you will need to recreate those templates in .Net since mixing .Net and classic in the same file is not possible.

您不应该将它真正添加到现有的经典ASP页面。您可能希望执行从传统ASP到.Net的完整(但很慢)的迁移。否则,您可能只是想完全在新页面中添加新功能。如果你有一个模板化网站,这可能会变得很麻烦,因为你需要在.Net中重新创建这些模板,因为在同一个文件中混合.Net和classic是不可能的。

You could ultimately end up resorting to iframes, but this makes browsers goofy sometimes. If your application is dependent on session, you'll need to account for that because .Net can't access a classic session unless you stick to primitives (string/int/etc) and use an outside state provider (like SQL) to hold the data with a sessionid that can be passed.

你最终可能会诉诸iframe,但这有时会让浏览器变得愚蠢。如果您的应用程序依赖于会话,您需要考虑到这一点,因为.Net无法访问经典会话,除非您坚持原语(string / int / etc)并使用外部状态提供程序(如SQL)来保存具有可以传递的sessionid的数据。

Having a hybrid site is a very tricky prospect and not one to be taken lightly. Tread carefully or you'll really put yourself in a pickle.

拥有一个混合网站是一个非常棘手的前景,而不是一个轻率的。仔细踩或者你真的会把自己放在泡菜里。

EDIT: Partial Hybrid example description

编辑:部分混合示例说明

We had a 700 or so page site to transfer from classic asp to Asp.Net 2.0. Many of the pages were allotted time to be completely transferred during a single project, but a few areas were unable to be refactored and had to be accommodated. We put together a master page architecture for the new .Net structure, data library and business objects library, and we began the transfer. In incorporating the classic asp pages, we determined we had a few needs.

我们有一个700左右的页面站点,从经典的asp转移到Asp.Net 2.0。许多页面被分配的时间在一个项目中被完全转移,但是一些区域无法被重构并且必须被容纳。我们为新的.Net结构,数据库和业务对象库组建了一个母版页架构,我们开始了转移。在整合经典的asp页面时,我们确定我们有一些需求。

  1. Since master pages would control basic layout, menu, header, footer, we would need to remove these elements from any pages brought over.
  2. 由于母版页将控制基本布局,菜单,页眉,页脚,我们需要从任何页面中删除这些元素。

  3. New session requirements were incompatible with existing session capabilities.
  4. 新会话要求与现有会话功能不兼容。

  5. Classic asp pages must still be required to obey .Net formsauthentication.
  6. 仍然需要经典的asp页面来遵守.Net formsauthentication。

I solved these problems with the following solutions:

我用以下解决方案解决了这些问题:

  1. Our application is targeted at a specific customer, so we were able to determine browser requirements. This allowed us to employ an iframe to hold classic asp content/applications without worrying that the iframe would go crazy on us in Webkit or Firefox or whatever.
  2. 我们的应用程序针对特定客户,因此我们能够确定浏览器要求。这使得我们可以使用iframe来保存经典的asp内容/应用程序,而不用担心iframe会在Webkit或Firefox或其他任何东西上疯狂。

  3. To accommodate the session requirements, we built a small encryption/decryption engine in .Net and in classic asp that enabled us to encrypt a "query string" to pass the session information back and forth. It wasn't super secure, just enough that the casual user would not be tempted to mess with data. In addition we had to build two translation files. The first translation file was a .Net library static method that would take the session data, extract the necessary pieces and create the query string. The second one was the classic asp version that was designed to read the query string, parse the data and create the session primitives directly.
  4. 为了满足会话要求,我们在.Net和经典asp中构建了一个小型加密/解密引擎,使我们能够加密“查询字符串”以来回传递会话信息。它不是超级安全,只是让临时用户不会想要弄乱数据。另外我们必须建立两个翻译文件。第一个转换文件是.Net库静态方法,它将获取会话数据,提取必要的部分并创建查询字符串。第二个是经典的asp版本,旨在读取查询字符串,解析数据并直接创建会话原语。

  5. Making the classic asp pages behave for .Net was a server management issue. To do this, using the formsauthentication attribute protection="All" is supposed to be sufficient, but I found it still did not cover items that had other handlers anticipated. So I added a wildcard mapping in IIS to handle all files. From the properties of the IIS website, choose "Home Directory" and click "Configuration". At the bottom of the next window is a "Wildcard application maps" box. Click insert and navigate to the version of .Net you use to find the aspnet_isapi.dll file. This will force all files to parse against this file (which is harmless except that it kicks up the authentication request).
  6. 使经典的asp页面表现为.Net是一个服务器管理问题。要做到这一点,使用formsauthentication属性protection =“All”应该足够了,但我发现它仍然没有涵盖其他处理程序预期的项目。所以我在IIS中添加了通配符映射来处理所有文件。从IIS网站的属性中,选择“主目录”,然后单击“配置”。在下一个窗口的底部是“通配符应用程序映射”框。单击插入并导航到您用来查找aspnet_isapi.dll文件的.Net版本。这将强制所有文件解析此文件(除了它启动身份验证请求之外,这是无害的)。

I can't provide specific code samples because of NDA, but this should at least provide some ideas on where to go from here.

由于NDA,我无法提供具体的代码示例,但这至少应该提供一些关于从何处开始的想法。

#2


0  

You can have classic ASP pages running inside an ASP.NET application. You can add your pages in ASP.NET

您可以在ASP.NET应用程序中运行经典ASP页面。您可以在ASP.NET中添加页面

#1


6  

You shouldn't really add it to the existing classic ASP pages. You may want to perform a full (yet slow) migration from classic ASP to .Net. Otherwise, you may just simply want to add your new functionality in new pages completely. If you have a templated site, this may become a litle cumbersome because you will need to recreate those templates in .Net since mixing .Net and classic in the same file is not possible.

您不应该将它真正添加到现有的经典ASP页面。您可能希望执行从传统ASP到.Net的完整(但很慢)的迁移。否则,您可能只是想完全在新页面中添加新功能。如果你有一个模板化网站,这可能会变得很麻烦,因为你需要在.Net中重新创建这些模板,因为在同一个文件中混合.Net和classic是不可能的。

You could ultimately end up resorting to iframes, but this makes browsers goofy sometimes. If your application is dependent on session, you'll need to account for that because .Net can't access a classic session unless you stick to primitives (string/int/etc) and use an outside state provider (like SQL) to hold the data with a sessionid that can be passed.

你最终可能会诉诸iframe,但这有时会让浏览器变得愚蠢。如果您的应用程序依赖于会话,您需要考虑到这一点,因为.Net无法访问经典会话,除非您坚持原语(string / int / etc)并使用外部状态提供程序(如SQL)来保存具有可以传递的sessionid的数据。

Having a hybrid site is a very tricky prospect and not one to be taken lightly. Tread carefully or you'll really put yourself in a pickle.

拥有一个混合网站是一个非常棘手的前景,而不是一个轻率的。仔细踩或者你真的会把自己放在泡菜里。

EDIT: Partial Hybrid example description

编辑:部分混合示例说明

We had a 700 or so page site to transfer from classic asp to Asp.Net 2.0. Many of the pages were allotted time to be completely transferred during a single project, but a few areas were unable to be refactored and had to be accommodated. We put together a master page architecture for the new .Net structure, data library and business objects library, and we began the transfer. In incorporating the classic asp pages, we determined we had a few needs.

我们有一个700左右的页面站点,从经典的asp转移到Asp.Net 2.0。许多页面被分配的时间在一个项目中被完全转移,但是一些区域无法被重构并且必须被容纳。我们为新的.Net结构,数据库和业务对象库组建了一个母版页架构,我们开始了转移。在整合经典的asp页面时,我们确定我们有一些需求。

  1. Since master pages would control basic layout, menu, header, footer, we would need to remove these elements from any pages brought over.
  2. 由于母版页将控制基本布局,菜单,页眉,页脚,我们需要从任何页面中删除这些元素。

  3. New session requirements were incompatible with existing session capabilities.
  4. 新会话要求与现有会话功能不兼容。

  5. Classic asp pages must still be required to obey .Net formsauthentication.
  6. 仍然需要经典的asp页面来遵守.Net formsauthentication。

I solved these problems with the following solutions:

我用以下解决方案解决了这些问题:

  1. Our application is targeted at a specific customer, so we were able to determine browser requirements. This allowed us to employ an iframe to hold classic asp content/applications without worrying that the iframe would go crazy on us in Webkit or Firefox or whatever.
  2. 我们的应用程序针对特定客户,因此我们能够确定浏览器要求。这使得我们可以使用iframe来保存经典的asp内容/应用程序,而不用担心iframe会在Webkit或Firefox或其他任何东西上疯狂。

  3. To accommodate the session requirements, we built a small encryption/decryption engine in .Net and in classic asp that enabled us to encrypt a "query string" to pass the session information back and forth. It wasn't super secure, just enough that the casual user would not be tempted to mess with data. In addition we had to build two translation files. The first translation file was a .Net library static method that would take the session data, extract the necessary pieces and create the query string. The second one was the classic asp version that was designed to read the query string, parse the data and create the session primitives directly.
  4. 为了满足会话要求,我们在.Net和经典asp中构建了一个小型加密/解密引擎,使我们能够加密“查询字符串”以来回传递会话信息。它不是超级安全,只是让临时用户不会想要弄乱数据。另外我们必须建立两个翻译文件。第一个转换文件是.Net库静态方法,它将获取会话数据,提取必要的部分并创建查询字符串。第二个是经典的asp版本,旨在读取查询字符串,解析数据并直接创建会话原语。

  5. Making the classic asp pages behave for .Net was a server management issue. To do this, using the formsauthentication attribute protection="All" is supposed to be sufficient, but I found it still did not cover items that had other handlers anticipated. So I added a wildcard mapping in IIS to handle all files. From the properties of the IIS website, choose "Home Directory" and click "Configuration". At the bottom of the next window is a "Wildcard application maps" box. Click insert and navigate to the version of .Net you use to find the aspnet_isapi.dll file. This will force all files to parse against this file (which is harmless except that it kicks up the authentication request).
  6. 使经典的asp页面表现为.Net是一个服务器管理问题。要做到这一点,使用formsauthentication属性protection =“All”应该足够了,但我发现它仍然没有涵盖其他处理程序预期的项目。所以我在IIS中添加了通配符映射来处理所有文件。从IIS网站的属性中,选择“主目录”,然后单击“配置”。在下一个窗口的底部是“通配符应用程序映射”框。单击插入并导航到您用来查找aspnet_isapi.dll文件的.Net版本。这将强制所有文件解析此文件(除了它启动身份验证请求之外,这是无害的)。

I can't provide specific code samples because of NDA, but this should at least provide some ideas on where to go from here.

由于NDA,我无法提供具体的代码示例,但这至少应该提供一些关于从何处开始的想法。

#2


0  

You can have classic ASP pages running inside an ASP.NET application. You can add your pages in ASP.NET

您可以在ASP.NET应用程序中运行经典ASP页面。您可以在ASP.NET中添加页面