Reputation: 363
Can we add the extra http response header item example "Last Updated" beside the default response header?
example when I call (Request):
localHost:12345/API/GetInfo
with header:
Host: localHost:12345
......
then the api will reply the header with(Response):
HTTP/1.1 200 OK
Content-Length: XX
Content-Type: XXX
Last-Update: The value and the value generate from the API function
Upvotes: 12
Views: 26748
Reputation: 198
I just found a solution. What I need to do is, response HTTP header in cookie format. That way, browser will always return it back to my web server.
Upvotes: 0
Reputation: 53
In MVC 5 just add
Response.AppendHeader("header", "value");
Upvotes: 0
Reputation: 3570
FYI there is an official HTTP Header that you can use to represent the DateTime a resource was last updated.
It is the 'Last-Modified' Header (See section 14.29 on Section 14 page of the specification).
You add it to your response like this:
Response.Content.Headers.LastModified = yourResource.LastUpdatedDateTime;
Upvotes: 9
Reputation: 8558
You can add header by using this code:
HttpContext.Current.Response.AppendHeader("Last-Update", value);
Upvotes: 26