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
Securitywise What are the Enhancements in 2.0?
What is the use of view state?
What is a ashx file?
If 200 is for all successful operation then why do we have 201 response codes?
there is two functions function a and function b like fun a(){.... ..... } fun b() { } in function b i write the coding to add two numbers and i need to dispaly the sum result in function a with out using global variable. how we do?
What is the namespace to create thread in .net?
What is strong-typing versus weak-typing?
What is difference between viewstate and session state in javascript?
How to find out what version of asp.net I am using on my machine?
What is the difference between WindowsDefaultLocation and WindowsDefaultBounds?
What is base class of .net?
Where session id is stored?
Why do we need url encoding?
What is http protocol and how it works?
What threading model used in asp and asp.net?