Answer Posted / nirav desai
Following is the way to construct to do so,
public class TestController : ApiController
{
public HttpResponseMessage Get()
{
HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, "value");
response.Content = new StringContent("Testing", Encoding.Unicode);
response.Headers.CacheControl = new CacheControlHeaderValue()
{
MaxAge = TimeSpan.FromMinutes(20)
};
return response;
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is http request and response?
What is the difference between viewstate and hidden field in asp.net?
What is the difference between file-based dependency and key-based dependency?
What's the use of response.output.write()?
Explain how do you validate the controls in an asp .net page?
benefits of migration from asp to asp.net hi frnds, i have to give presentation to a client about how useful would be migrating their project from asp to asp.net .plz give me some points which i should incorporate in my ppt thanks
What is meant by web application?
Explain authorization levels in .net ?
Which namespace is used by ado.net?
Briefly describe the role of global.asax?
How to retrieve user name in case of Window Authentication?
Which is an advantage of application service providers?
What is the difference between pathparam and queryparam?
Explain how to prepare culture-specific formatting in .net.
What is the use of data set in asp.net?