Random stuff around migration from Umbraco 7 to vNext

By Markus Johansson
2023-08-21

This year has been a lot about migration. Since Umbraco 7 will be end of life quite soon we help a lot of clients to migrate.

There is a lot of great content already out there about the migration process so I figured I'll share some of the "bumps" 

 

JQuery and Umbraco Api Controllers

Many times we have code that sends a vanilla MVC-form using JQuery's $.post feature like this:

$.post("/Umbraco/Api/MyController/DoSomething", $("#form").serialize())

When posting this to the controllers we noticed a strange error from the controller.

 

{
 "type":"https://tools.ietf.org/html/rfc7231#section-6.5.13",
 "title":"Unsupported Media Type",
 "status":415,
}

JQuery will post the data as form data but the controller expects JSON, the simple solution is to add a [FromForm]-attribute in the controller action.

 

[HttpPost]
public IActionResult DoSomething([FromForm] MyModel model)
{
}

 






More blog posts



15 januari 2021

Umbraco and MiniProfiler