旧mvc5中的C#MVC响应
在新的.NET内核中,我可以为WEB API实现这一点旧mvc5中的C#MVC响应,c#,asp.net-mvc,rest,C#,Asp.net Mvc,Rest,在新的.NET内核中,我可以为WEB API实现这一点 Response.AddPagination(page, pageSize, totalUsers, totalPages); public static void AddPagination(this HttpResponse response, int currentPage, int itemsPerPage, int totalItems, int totalPages) { var pag
Response.AddPagination(page, pageSize, totalUsers, totalPages);
public static void AddPagination(this HttpResponse response, int currentPage, int itemsPerPage, int totalItems, int totalPages)
{
var paginationHeader = new PaginationHeader(currentPage, itemsPerPage, totalItems, totalPages);
response.Headers.Add("Pagination",
Newtonsoft.Json.JsonConvert.SerializeObject(paginationHeader));
// CORS
response.Headers.Add("access-control-expose-headers", "Pagination");
}
在旧的MVC5中如何操作?用什么代替
Response.AddPagination(page, pageSize, totalUsers, totalPages);
你同意吗
var response = HttpContext.Current.Response;