How do you construct HtmlResponseMessage?
Answer / 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 |
Can we store object in viewstate?
What are the different web pages?
Can you nest updatepanel within each other?
Contrast the use of an abstract base class against an interface?
What is the use of placeholder control?
What is asp net objects?
What are main return types supported in Web API?
Explain how cookies work. Give an example of cookie abuse.
why we should use more than one web.config files in our application? I have two web.config files in my application. One in the root directory and another one inside a sub folder. When the application runs which web.config file will run? why?
can I use session variable in App_code Class page??
How many types of sessions are there in asp net?
Explain what a diffgram is, and a good use for one?