We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Attempting to Save Spreadsheet - 415 Error Code

I am trying to implement the Open and Save functionality for a Spreadsheet using a .NET WebAPI server. I am able to open a file successfully, but saving it results in my page getting redirected to the WebAPI and returning a 415 (Unsupported Medai Type) error. Any help would be appreciated. 

I am using Vue 3 and .NET 6.0. I have installed Syncfusion.EJ2.Spreadsheet.AspNet.Core and Syncfusion.XlsIORenderer.Net.Core.


Vue Code. The Vue application is running on localhost:8087

app_code.png


WebApi Code. The API is running on localhost:7018

api_running.png


After attempting to save, the Vue application redirects to this URL.

after_saving.png


1 Reply 1 reply marked as answer

SP Sangeetha Priya Murugan Syncfusion Team December 7, 2022 12:48 PM UTC

Hi Mackenzie,


We suspect the cause of this issue is due to the saveSettings argument not being recognized properly in server side save actions. So, we suggest you use the [FromBody] or [FromForm] property in the controller action as shown below.



public string Save([FromBody] SaveSettings saveSettings)

{

                Workbook.Save(saveSettings);

}

 

 

Or

     

[HttpPost]

        [Route("Save")]

        public IActionResult Save([FromForm]SaveSettings saveSettings)

        {

            return Workbook.Save(saveSettings);

        }


For more details, please refer to the below link.


https://stackoverflow.com/questions/24625303/why-do-we-have-to-specify-frombody-and-fromuri

Please check the above details and get back to us if you need any further assistance on this.


Marked as answer
Loader.
Up arrow icon