WebAPI to Return XML

前端 未结 5 1749
挽巷
挽巷 2020-11-28 07:34

I\'m wanting my WEB API method to return an XML object back to the calling application. Currently it\'s just returning the XML as a string object. Is this a no no? If so how

5条回答
  •  Happy的楠姐
    2020-11-28 07:48

    If you return a serializable object, WebAPI will automatically send JSON or XML based on the Accept header that your client sends.

    If you return a string, you'll get a string.

提交回复
热议问题