Classic ASP using MVC routing on IIS7

守給你的承諾、 提交于 2019-12-11 13:33:40

问题


After taking the first hurdle, I found something amusing.

Direct access (i.e. /OLD/ASP/myFile.asp) to the page works (well, no, but it returns a plausible ASP error ;) ).

However, trying to route the page such as:

routes.MapPageRoute(
        "OldASP",
        "Page/{*id}",
        "~/OLD/ASP/myFile.asp",
        false,
        new RouteValueDictionary(),
        new RouteValueDictionary(new { @id = @"\d+" })
    );

Returns the magnificant There is no build provider registered for the extension '.asp'. error (which was originally solved for direct access as described above)

How can I keep routes and ASP? (tried this to no avail)


回答1:


I'd be surprised if you can use Classic ASP pages within a .net mvc project. You can certainly use .aspx and .asp pages in the same website

Your best bet is probably to use web.config and the rewrite module

http://www.surfingsuccess.com/asp/iis-url-rewrite.html#.UtaDhkA15tA

One thing to watch out for, if you're using asp.net MVC then there is potential for conflicts between web.config and MVC's own routing system

Take a look at this question IIS URL Rewrite ASP




回答2:


If you have a Classic ASP application and you are looking to use the MVC routing you may try to create your own Router for the "nice URLs". The idea is to use IIS Error 404 handler to parse the nice URL. I had projects (both VBScript and JScript) entirely written in Classic ASP with "nice URL" and custom router. Check this: http://www.codeproject.com/Articles/706216/Classic-ASP-MVC-for-dynamic-JavaScript-pages



来源:https://stackoverflow.com/questions/21133251/classic-asp-using-mvc-routing-on-iis7

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