My Controller method returns Json object which has url formed as shown below :
return Json(new { url = Url.Action("ShowContact", "Customer", new { vm = contactVM }) }, JsonRequestBehavior.AllowGet);
In the ajax call's success code, I want to assign this url to window.location.href so I can redirect to view as per url formed. But return value of ajax call shows plain text value for route value passed as part of url.
Hence, I'm not getting whatever route value I want to pass to the redirect action method of my controller.
So what are the options I have in order to pass my route value which is complex c# object including collections? Is there any better approach to achieve what I want to do?
Thanks,
contactVMis clearly a complex object, even if you used the correct syntax, this probably wont work anyway. You should not pass complex objects to a GET method. Apart from the ugly query string, if the model contains properties which are complex objects or collections, binding will fail and there is a chance you could exceed the query string limit and throw an exception