1

First let me explain that I am on a hosted solution, and there is not much I can do in ways of configuration and settings for IIS 6.

I have MVC2 working to a degree, I'm using the following Global.asax code:

    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            "Default",
            "{controller}.aspx/{action}/{id}",
            new { action = "Index", id = "" }
        );

        routes.MapRoute(
            "Root",
            "",
            new { controller = "Default", action = "Index", id = "" }
        );
    }

In the first route, I had to specify {controller}.aspx, due to IIS 6 not being able to execute non aspx code (or something like that, not really sure).

Which is fine, the following works: hxxp://mysite.com/home.aspx, hxxp://mysite.com/projects.aspx, hxxp://mysite.com/contact.aspx

which are all controllers and I can run their respected actions as well.

The problem is that I can not do an empty URL properly (ie hxxp://mysite.com/), it gives me a "Directory Listing Denied" error.

The question I have, is with a default.aspx file located at root (which does execute), can I load the Home controller WITHOUT using a simple Response.Redirect?

Thank you, Matthew

4

3 に答える 3

1

「Directory Listing Denied」というメッセージが表示されるということは、isapi filetr が MVC での作業に一致しないことを意味します。

于 2010-12-22T14:57:32.043 に答える
0

IIS6 および IIS7 でこの動作を無効にすることができます。

// Disable IIS looking at physical files and directories
RouteTable.Routes.RouteExistingFiles = true;
于 2011-03-07T19:42:57.233 に答える
0

「Directory Listing Denied」というメッセージが表示されるということは、デフォルトのドキュメントがなく、サーバーがルート フォルダにあるファイルのリストを表示しようとしていることを意味します。

既定のドキュメントを "Default.aspx" などに更新します。ホスティング プロバイダーには、このためのオプションが必要です。これは非常に一般的です。

于 2010-11-19T16:32:36.460 に答える