Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
旧mvc5中的C#MVC响应_C#_Asp.net Mvc_Rest - Fatal编程技术网

旧mvc5中的C#MVC响应

旧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

在新的.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 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;