Returning http status code from Web Api controller
问题 I\'m trying to return a status code of 304 not modified for a GET method in a web api controller. The only way I succeeded was something like this: public class TryController : ApiController { public User GetUser(int userId, DateTime lastModifiedAtClient) { var user = new DataEntities().Users.First(p => p.Id == userId); if (user.LastModified <= lastModifiedAtClient) { throw new HttpResponseException(HttpStatusCode.NotModified); } return user; } } The problem here is that it\'s not an