开发者

ASP.NET MVC and Classic ASP side-by-side

I have a legacy Classic ASP application that I'm in the process of migrating to ASP.NET MVC 3. I have them running side-by-side in a virtual directory in IIS 6 (Windows 2003).

In my HomeController I have a single action:

    public RedirectResult Index()
    {
        // go to our Classic ASP application for the time being.
        return Redirect("/default.asp");
    }
开发者_运维技巧

This is supposed to redirect the user to default.asp, where the Classic ASP application starts. However, when I hit the root of the site in the browser, I get a 302 Redirection Loop between '/' and '/default.asp'.

If I go directly for '/default.asp' everything works fine.

I've put some debug code in the top of default.asp to just print out some text and stop (in case it was causing the 302) but it would appear that IIS never actually processes the file.

Any ideas?


I've just managed to fix this problem by changing the how I referenced the file I'm redirecting to. It seems that removing the leading '/' makes it work:

public class HomeController : Controller
{
    public RedirectResult Index()
    {
        // go to our Classic ASP application for the time being.
        return Redirect("default.asp");
    }
}

I don't know why this is, I can only expect that it's triggering IIS to process the request back to MVC.


check your IIS default page and see if default.asp is one of them. If so then you are just going to Index action in your MVC application over and over.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜