Question

i have a mixed aspx/MVC webapp project and need to rewrite incoming URL's either in the MVC routing or through IIS rewriting. whatever works. I cannot figure this out.

I have the following OLD path:

/Article/Nugget/Article.aspx?articleId=30

and i need to rewrite this to:

/Article/Nugget/30

The issue is the MVC route is reading in the Article.aspx being passed as a parameter and anything i do to rewrite this in IIS7 is being ignored. Well.. the issue is i don't have a clue :)

Was it helpful?

Solution

Try something like:


routes.MapRoute(
            "Article",
            "Article.aspx",
            new { controller = "Article", action = "Nugget"}
        );

With a parameter named articleId in your action method of course

public ActionResult Nugget(int articleId)
{
..
}

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top