ASP MVC.Net 3 RC2 bug ?
- by Jarek Waliszko
Hello,
so far I've been using ASP.Net 3 BETA. Everything was working fine till the update to RC2 version. Of course I've read ScottGu's article about RC2.
My problem is following. Basically I have 2 controllers:
public class DynamicPageController : Controller
{
public ActionResult Redirect(string resource, int? pageNumber, int? id)
{
}
}
public class SystemController : Controller
{
public ActionResult Index()
{
}
}
In the Globals.asax I have routes like this:
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapRoute(
"SystemRoute",
"System/{action}",
new { controller = "System", action = "Index" }
);
routes.MapRoute(
"PageRoute",
"{resource}/{id}/{pageNumber}",
new { controller = "DynamicPage", action = "Redirect", resource = UrlParameter.Optional, pageNumber = UrlParameter.Optional, id = UrlParameter.Optional }
);
}
In the code, I have simple link creation:
System.Web.Mvc.UrlHelper u = new System.Web.Mvc.UrlHelper(context);
string url = u.Action("Index", "System");
and the url is "/my_app/System" in both versions (BETA and RC2)
But the code below (the syntax is the same as above, only controller and action names are different):
string url = u.Action("Redirect", "DynamicPage", new RouteValueDictionary(new { resource = "Home" }));
gives url which is null in RC2. It should be (and in fact in BETA was) "/my_app/Home"
Why ? Is it a bug ? How can I create url for my "DynamicPage" controller ?
Regards
BTW: From where can I now download ASP.Mvc BETA version along with ASP.Net Web Pages 1.0 installers ? Since RC2 announcement I have problems finding mentioned 2 installers. Normally I would upgrade my code but this issue described above makes me stay with BETA for a while, since I have no time for migration and testing everything now.