[英]MVC RedirectToAction is not working properly
In one of my controllers, I do have a return that looks like this: 在我的一个控制器中,确实有一个类似以下的收益:
return RedirectToAction("AdministerFiles/ViewDataFiles?catid=14");
but when it renders the result to the browser the string becomes this one: 但是,当将结果呈现给浏览器时,字符串变成了这个字符串:
AdministerFiles/AdministerFiles/ViewDataFiles%3fcatid%3d14
how can I solve this ? 我该如何解决? thanks .
谢谢 。
You just need the action as the parameter (along with the route data): 您只需要将动作作为参数(以及路线数据):
return RedirectToAction("ViewDataFiles", new { catid = 14 });
If you want to specify the controller as well (it defaults to the current controller), then you can do it like this: 如果还要指定控制器(默认为当前控制器),则可以这样进行:
return RedirectToAction("ViewDataFiles", "AdministerFiles", new { catid = 14 });
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.