Sean
Sean

Reputation: 15172

GetOwinContext in ASP.NET5 / MVC6

In WebApi I used to do this on my BaseApiController:

Request.GetOwinContext().Response.Headers.Add("X-Pagination", new[] { Newtonsoft.Json.JsonConvert.SerializeObject(paginationHeader) });

I'm converting to ASP.NET v5, and I get the error:

HttpRequest does not contain a definition for GetOwinContext

Any pointers?

Upvotes: 0

Views: 1096

Answers (1)

Kévin Chalet
Kévin Chalet

Reputation: 42110

ASP.NET 5 is not based on OWIN, so don't expect GetOwinContext() to work.

Your code can be easily adapted to the new HttpResponse primitive:

Response.Headers["X-Pagination"] = JsonConvert.SerializeObject(paginationHeader);

Upvotes: 1

Related Questions