Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

passing multiple parameters in url in MVC 3

I have action method in controller called "Registration" as

public ActionResult Facility(int id = 0, int contractId = 0)

when I call this method from url like

/Registration/Facility/0?contractId=0

it works fine. Now when I try to construct above url in another method like

return RedirectToAction("Facility/0?contractId="+ model.ContractId);

it doesn't work, the url in browser is not constructed well it comes like

/Registration/Facility/0%3fcontractId%3d0

can anyone please tell me what wrong I'm doing here?

like image 846
pramodtech Avatar asked Apr 27 '11 06:04

pramodtech


1 Answers

Try this:

return RedirectToAction("Facility", new { id = 0, contractId = model.ContractId});

See this answer

like image 152
jao Avatar answered Sep 29 '22 20:09

jao