Scenario
Render a ASP.NET MVC Razor view with a model from the controller.
Error / Exception
System.ArgumentException: Illegal characters in path.
Cause
The model from the controller was returning JSON and the view had declared “@model string” to handle the JSON.
Solution
Updates in both controller and view. Change controller return type from string to the object.
Controller
Original: return View(JsonConvert.SerializeObject(List));
Change to: return View(List);
View
Original: @model string
Change to: @model List<object>