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 does uri mean?
What is the difference between user control an custom control?
What is x xss protection?
Give an example appropriate use forweb service as opposed to a non-serviced .NET component
How do you declare static variable?
1. What is the difference between Cache and Session? 2. I cache limited to page like viewstate or it's accessible through out the application like session? 3. Which one is better when I've some data that is to be used across the application? Why is to better than the other?
Why do we need master page in asp.net?
What is the need to give <compilation debug=true> command ?
What is an Interface and What is an Abstract Class?
Explain how can we inherit a static member?
How u refer webservices?
What's the difference between Page.RegisterClientScriptBlock and Page.RegisterStartupScript ?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)