0

How do I route this directory:

mywebsite/Views/Reports/Page.aspx

To this directory?

mywebsite/Reports/Page.aspx

The page must be a wild card, so something like this:

mywebsite/Views/Reports/*

To something like this:

mywebsite/Reports/*

Here is what I got:

            routes.MapRoute(
                name: "Reports",
                url: "Views/Reports/*",
                defaults: new { controller = "Reports"}
            );
Bill Software Engineer
  • 7,362
  • 23
  • 91
  • 174

1 Answers1

0

I am not sure whether I am getting your question completly, you can try this

        routes.MapRoute(
            "Test",
            "{upperDirectory}/{controller}/{action}",
            new { controller = "Reports", action="YourAction" },
        );

In this, your URL must have one value for variable upperDirectory.

Guanxi
  • 3,103
  • 21
  • 38
  • This is better : routes.MapRoute( "Test", "Views/{controller}/{action}.aspx", new { controller = "Reports", action="Page" } ); – fred May 07 '13 at 20:34
  • Yes you are right, but I thought in case the one level up directory is not just Views. – Guanxi May 08 '13 at 03:47