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 .

Answers


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 });

Need Your Help

Trying to remove three or more <br> from the_content

php regex

As the title says I'm trying to remove and replace three or more &lt;br&gt; from get_the_content(); in my single.php.