Trying to set up a new site using MVC RC4 web API in Visual Studio 2010, and it just seems to not work: parameter values are never passed to the method.
Everything was working fine in mvc2 but since the upgrade to mvc 4 most of the thing started falling apart.
public ActionResult DownloadApp(string id, bool download = false){}
I am trying to pass the download parameter but the controller is not catching it
RedirectResult (Url.Action("DownloadApp", "Account") + "?download=true");
Like I've mentioned, it was working fine in MVC 2. I am forced to use Queryparameter
that I don't want to use. Is there any way I can make get it to work in MVC 4 like before. The route is as follows:
RouteTable.Routes.MapRoute(
"Default",
"api/{controller}/{action}/{id}",
new { controller = "account", action = "index", id = "" },
namespaces
);
尝试这种方式:
new RedirectResult(Url.Action("DownloadApp", "Account", new { download = true }));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.