For a string specifically, the quickest way is to use the StringContent constructor
response.Content = new StringContent("Your response text");
There are a number of additional HttpContent class descendants for other common scenarios.
More Related Contents:
- How to secure an ASP.NET Web API [closed]
- How to add/update child entities when updating a parent entity in EF
- Make sure that the controller has a parameterless public constructor error
- Web API Put Request generates an Http 405 Method Not Allowed error
- ASP.NET Core MVC : How to get raw JSON bound to a string without a type?
- How can I use a reserved keyword as an identifier in my JSON model class?
- Deserialising JSON to derived types in Asp.Net Web API
- prevent property from being serialized in web API
- How to update a claim in ASP.NET Identity?
- Difference between MVC 5 Project and Web Api Project
- 404 error after adding Web API to an existing MVC Web Application
- MVC web api: No ‘Access-Control-Allow-Origin’ header is present on the requested resource
- How to extend IdentityUser with custom property
- Return HTML from ASP.NET Web API
- TempData null in asp.net core
- MVC Attribute Routing Not Working
- ASP.NET Core v2 (2015) MVC : How to get raw JSON bound to a string without a type?
- POST string to ASP.NET Web Api application – returns null
- How to add Web API to an existing ASP.NET MVC (5) Web Application project?
- Effectively use async/await with ASP.NET Web API
- Read HttpContent in WebApi controller
- Web Api Request Content is empty in action filter
- Why is this web api controller not concurrent?
- ASP.NET Web API and [Serializable] class
- How to add and get Header values in WebApi
- Web API in MVC solution in separate project
- AngularJS Web Api AntiForgeryToken CSRF
- WCF Service or Web API [closed]
- JSON Deserialization – String Is Automatically Converted To Int
- What is the difference between DependencyResolver.SetResolver and HttpConfiguration.DependencyResolver in WebAPI