We have a classic VBScript "default.asp" page in the root of our site. (This is a heavy, legacy page and converting it is not an option right now.) We also have a new ASP.NET MVC 2 application we want to host on the same site. Everything actually works great together! Except for one thing: requests to the root of the site (e.g., /) get picked up by the MVC routing (which then wants to display the HomeController's Index action) instead of letting the default.asp page take the request!
This is what I would like:
http://www.example.com/ <- should execute the classic default.asp page, not /Home/Index!
I can't figure out how to not execute HomeController.Index(). If I remove the HomeController, I get an error. If I try to IgnoreRoute("") I get an error. I have even changed the priority/order of the "default document" in IIS for this site to treat "default.asp" as the preferred document. I've even deleted the dummy MVC "default.aspx" page out of the root, and still the MVC routing is "stealing" requests for the root of the site.
The temporary solution is for me to have HomeController.Index redirect the user back to "default.asp". This works, but then it shows up 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 get these both to co-exist? Perhaps something I can add to web.config to make this specific exception for the homepage? Thank you!
I apologize for the delay in getting back to this but it went on the back burner for a while and I honestly almost forgot about this; however I did manage to get this working! I'd like to give credit to both Chris Marisic and Chance, since combined they helped me figure this out.
The problem was that sure enough, it seems there was a default route (as Chance suggested in a comment) that was catching these requests to the site root.
So, by tweaking this, and also adding routes.IgnoreRoute(""); (empty-string) as the first rule in my routing list, this now works!
Thank you everyone for your help!
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With