如何使用 .Net 处理程序处理 .asp 扩展?

How do I process .asp extensions using the .Net handler?(如何使用 .Net 处理程序处理 .asp 扩展?)
本文介绍了如何使用 .Net 处理程序处理 .asp 扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个旧的经典 ASP 网站,我正在迁移到 IIS7.5.我不想在服务器上安装经典的 ASP,所以我只想将 .asp 文件视为 .aspx 文件.

I have an older classic ASP website that I am migrating over to IIS7.5. I don't feel like installing classic ASP on the server, and so I just want the .asp files to be treated as if they were .aspx files.

如何在 IIS7.5 中执行此操作?

How do I go about doing this in IIS7.5?

澄清一下,我不是在问如何让经典的 ASP 代码在 .Net 下工作.我只是在问如何映射要由 .net 运行时处理的 .ASP 文件扩展名.我会将 .asp 文件中的代码升级为 .net.

To clarify, I am NOT asking how to get classic ASP code to work under .Net. I am just asking how to map the .ASP file extension to be handled by the .net runtime. I will upgrade the code in the .asp files to .net.

我放弃并最终安装了经典 ASP,因为我无法使映射工作(收到 404.17 和 404.3 错误的组合).我将 David Lively 的答案标记为正确,因为它是最详细和最有帮助的.

I gave up and ended up installing classic ASP, as I couldn't get the mapping to work (received a combination of 404.17 and 404.3 errors). I marked David Lively's answer as correct as it was the most detailed and helpful.

推荐答案

这行不通.处理执行 ASP.NET 应用程序的 Aspnet_isapi.DLL 不理解经典 ASP,并将尝试将经典 VBScript 代码解析为 .NET VBScript.

That's not going to work. Aspnet_isapi.DLL, which handles executing ASP.NET applications, doesn't understand classic ASP, and will try to parse the classic VBScript code as .NET VBScript.

唯一可行的方法是,如果您的 .ASP 页面中没有(我的意思是绝对没有)经典 ASP 代码.

The only way this is feasible is if you have no (and I mean ABSOLUTELY NONE) classic ASP code in your .ASP pages.

如果是这样,您可以将 .ASP 扩展名映射到 IIS 管理器中的 aspnet_isapi.

If that is the case, you can map the .ASP extension to aspnet_isapi in IIS manager.

  1. 打开inetmgr.
  2. 选择网站
  3. 在功能视图"面板中,选择处理程序映射"
  4. 将 .ASP 的映射添加到 C:Windowsmicrosoft.netframeworkv2.0.50727aspnet_isapi.dll(假设您使用的是 ASP.NET 2.x).
  1. Open inetmgr.
  2. Select the website
  3. In the Feature View panel, select "Handler Mappings"
  4. Add a mapping for .ASP to C:Windowsmicrosoft.netframeworkv2.0.50727aspnet_isapi.dll (assuming you're using ASP.NET 2.x).

同样,如果您的 .asp 页面中有任何代码,这将导致每个 .ASP 页面出现光彩夺目的技术色彩失败.

Again, if you have any code in your .asp pages, this will cause a glorious, technicolor failure for every .ASP page.

另一种选择是使用重写引擎(我们使用 ISAPI Rewrite)来更改文件从 .asp 到 .aspx 的传入请求的扩展.

Another option is to use a rewrite engine (we use ISAPI Rewrite) to change the file extension of incoming requests from from .asp to .aspx.

您为什么不想在服务器上安装经典的 ASP?它可以与 ASP.NET 并行工作.

Why don't you want to install classic ASP on the server? It works just fine in parallel with ASP.NET.

编辑

它实际上被称为处理程序映射".见上图.

It's actually called "handler mappings." See image above.

这篇关于如何使用 .Net 处理程序处理 .asp 扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
how do i pass parameters to aspnet reportviewer(如何将参数传递给aspnet report查看器)
Bind multiple parameters from route and body to a model in ASP.NET Core(在ASP.NET Core中将路由和主体中的多个参数绑定到一个模型)
Custom model binding in AspNet Core WebApi?(AspNet Core WebApi中的自定义模型绑定?)
How to minify in .net core mvc view?(如何在.Net核心MVC视图中缩小?)