I thought this would be simple but I'm running into an issue of forcefully returning XML data.
Ideally, I'm looking for a solution that can request the GET URL and the XML formats the report controller only
I was hoping I would be able to send a configuration change before outputting data normally with return Ok(obj); but have not been able to find anything.
I've tried using the Microsoft.AspNetCore.Mvc.Formatters.Xml.Extensions nuget package but it seems like an overly complicated solution for what I'm looking for.
Thank you.
If you would like to restrict the response formats for a specific action you can, you can apply the [Produces] filter.
[Produces("application/xml")]
public class YoursController
The [Produces] filter will force all actions within the YoursController to return XML-formatted responses, even if other formatters were configured for the application.
For more information refer Forcing a Particular Format section.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With