How to return raw string with ApiController?

前端 未结 6 845
萌比男神i
萌比男神i 2020-11-29 21:49

I have an ApiController that serves XML/JSON, but I would like one of my actions to return pure HTML. I tried the below but it still return XML/JSON.

public          


        
6条回答
  •  攒了一身酷
    2020-11-29 22:29

    Just return Ok(value) won't work, it will be treated as IEnumerable.

    Instead use return Ok(new { Value = value }) or simillar.

提交回复
热议问题