How do I process .asp extensions using the .Net handler?

被刻印的时光 ゝ 提交于 2020-01-30 10:53:17

问题


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.

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

EDIT: 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.

EDIT:

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.


回答1:


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.

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

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

  1. Open inetmgr.
  2. Select the website
  3. In the Feature View panel, select "Handler Mappings"

  4. Add a mapping for .ASP to C:\Windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll (assuming you're using ASP.NET 2.x).

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

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.

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

edit

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




回答2:


It won't work. ASP and ASP.NET are different things.

ASP.NET doesn't support VBScript, for instance. It also doesn't support includes.




回答3:


I Think ASP is not enabled by defualt in the IIS7, so you might have to enable it by using windows control panel Control:

Panel/Programs/Turn On/Off Windows Features/Internet Information Services/WorldWideWeb Services/ Application Development Features / [ASP][ISAPI FILTERS] etc...

Then choose all features you need.

Cheers




回答4:


You must follow the start menu as given below to get VS2010 command prompt.

  1. Start -> All Programs -> Microsoft Visual Studio 2010 -> Visual Studio Tools -> Visual Sutdio Command Prompt(2010)

  2. Right Click on the Visual Studio Command Prompt (2010) and select Run as Administrator in case of Windows 7 and Vista

  3. then apply aspnet_regiis.exe -i



来源:https://stackoverflow.com/questions/4659700/how-do-i-process-asp-extensions-using-the-net-handler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!