Can ASP.NET MVC routing and a classic ASP homepage (VBScript, not web forms) play together nicely?

江枫思渺然 提交于 2019-12-04 14:00:50

You want to add the home route to the ignore route list.

Something along the lines of

routes.IgnoreRoute("/");

or

routes.IgnoreRoute("/default.asp");

This maybe not what your looking for, but what about trying something like the ASP Classic Compiler and add it to your Home Controler

http://aspclassiccompiler.codeplex.com/

Regards

Iain

I'm not sure about this, but you should be able to add default.asp to your default file list (iis). From there, just make sure all of your routes have a prefix (ie: "something/{id}")

the simplest way would be using a subdomain. i had a similar problem, my solution was to modify the asp-pages to render xml as output and screen scraped the output from the mvc application.

I think ignoring the route should work, though that behavior might lead to unintended consequences.

Crazy talk answer: move the page somewhere, make whatever action lives at "~/" turn around and make a WebRequest to that page and then send that as content to the browser.

I've just been dealing with this issue on our intranet.

Assuming that routes.RouteExistingFiles = false; The main problem is that MVC will take the base root as valid so IIS won't try to use default.asp so you need to try and break this somehow. My suggestions are:

Remove the Index route on your controller

Not just the Index route but also the default action that points to Index. If MVC doesn't match the root then IIS can try its defaults

Redirects

You could use the Index action method to give a RedirectResult to default.asp. It's an extra trip round but also means if/when you update that part of the application you just replace the index method.

URL rewriting

This is my preferred solution, use the IIS URL Rewrite module, it's quite powerful and gives you several options. you could get it to send a redirect back to the browser to the specific route. More interestingly you can get it to rewrite the URL to append the default.asp. This means MVC sees the url which includes the file but doesn't need to send the browser a redirect.

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