Can ASP.NET MVC routing and the classic ASP homepage (VBScript, not web forms) work well together?

We have the classic VBScript page "default.asp" at the root of our site. (This is a heavy, outdated page and converting it now is not an option.) We also have a new ASP.NET MVC 2 application that we want to host on the same site. Everything really works great together! Except for one: requests to the root of the site (for example /) are obtained using MVC routing (which then wants to display the action of the HomeController index) instead of allowing the default.asp page to execute the request!

Here's what I would like:
http://www.example.com/ <- should execute the classic default.asp page, and not / Home / Index!

I can’t figure out how to fail HomeController.Index(). If I remove HomeController, I get an error. If I try to ignore Route ("), I get an error. I even changed the priority / order of the" default document "in IIS for this site to treat" default.asp "as the preferred document. I even deleted the dummy MVC page" default.aspx "is from the root, and yet MVC routing is" stealing "requests for the site root.

The workaround for me is HomeController.Index redirects the user back to default.asp. This works, but then it appears ugly and visible in the address bar,
http://www.example.com/default.asp <- not what I want to show.

Any suggestions / answers on how to use them to coexist? Perhaps something that I can add to web.config to make this specific exception for the main page? Thank!

UPDATE

I apologize for the delay in returning to this, but for a while he returned to the background, and I honestly almost forgot about it; however, I succeeded! I would like to pay tribute to both Chris Maris and Chance, as they helped me understand this.

, , , ( ), .

, , routes.IgnoreRoute(""); ( ) , !

!

+3
6

ignore.

-

routes.IgnoreRoute("/");

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

+2

, , , , - ASP Classic Compiler .

http://aspclassiccompiler.codeplex.com/

+3

, default.asp (iis). , (: "something/{id}" )

+1

- . , , asp- xml , mvc.

0

, , .

: -, , "~/", WebRequest , .

0

.

, routes.RouteExistingFiles = false; , MVC , IIS default.asp, - . :

, , . MVC , IIS

Index, RedirectResult default.asp. , , / , .

URL

, IIS URL Rewrite, . . URL-, default.asp. , MVC URL-, , .

0

Source: https://habr.com/ru/post/1769211/


All Articles