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 |
What is the use of service provider?
Which class provides methods that can be used to manage role membership to be used in user authorization?
What is redirecting behavior?
What is the asp.net mvc folder conventions? : asp.net mvc
What are the advantages of Web API?
what are the State management and Its Uses
What is role manager work in web.config? how to restrict perticular pages from the users using the role manager?
Why mvc is better than asp.net? : Asp.Net MVC
How to kill session?
What is the Difference between MVC And MVP design pattrens
When working with ASP.Net server controls, it is important to use the right event handlers to capture the event for the application to function properly. What event would you use to capture the selection of a new item in a DropDownList control? a) The Click event. b) The SelectionChanged event. c) The SelectionIndexChanged event. d) The ChangedSelection event.
Whats the difference between abstract factory pattern and factory pattern?