Scenario
Render a ASP.NET MVC Razor view with a model from the controller.
Error / Exception
System.ArgumentException: Illegal characters in path.
![](http://www.osco.se/wp-content/uploads/2020/05/Illegal-characters-in-path--1024x574.png)
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>