Arjel
Arjel

Reputation: 469

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 .

Upvotes: 0

Views: 2025

Answers (1)

McGarnagle
McGarnagle

Reputation: 102793

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

Upvotes: 10

Related Questions