Paweł Reszka
Paweł Reszka

Reputation: 1557

MapPageRoute redirecting wront pages

I have a ASP.NET MVC3 Razor project. I wanted to add aspx page to this project and I found that it is possible by using MapPageRoute. I added it to my GlobalAsax.RegisterRoutes and it's redirecting me to my aspx page. But also most of the old pages are also redirected to this - they;re getting URL like this:

http://localhost:61000/AEM/Report?action=EditUser&controller=Settings

My RegisterRoutes method:

public static void RegisterRoutes(RouteCollection routes)
    {
        routes.MapPageRoute(
            "TelerikReport",
            "AEM/Report",
            "~/WebForms/TelerikReport.aspx", true
        );

        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Account", action = "LogOn", id = UrlParameter.Optional } // Parameter defaults
    }

What am I doing wrong here?

Edit: I noticed that it's redirecting pages wrong when I use "return RedirectToAction(...)" in my controllers.

Upvotes: 2

Views: 750

Answers (1)

PM.
PM.

Reputation: 1721

Try to modify your code like:

  routes.MapPageRoute(
        "TelerikReport",
        "AEM/Report/{*queryvalues}",
        "~/WebForms/TelerikReport.aspx", true
    );

Though I am not sure, but you can give it a try. As explained Here.

Upvotes: 1

Related Questions