title: Blazor httpcontext in helperclass is null
body: <p>Hello I am following a very helpful guide on adding pagination to blazor from this link: <a href="https://www.youtube.com/watch?v=kGvmAeSObsA" rel="nofollow noreferrer">https://www.youtube.com/watch?v=kGvmAeSObsA</a>. My issue is that I have went ahead and made a helper class and a task in it that passes an httpcontext. This is the code code for my helper:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Threading.Tasks;
  using Microsoft.AspNetCore.Http;
  using Microsoft.EntityFrameworkCore;
  
  
  namespace TranactionJournalV4.Helpers
  {
      public static class HttpContextExtensions
      {
          public static async Task InsertPaginationParameterInResponse&lt;T&gt;(this HttpContext httpContext,
              IQueryable&lt;T&gt; queryable, int recordsPerPage)
          {
              double count = await queryable.CountAsync();
              double pagesQuantity = Math.Ceiling(count / recordsPerPage);
              httpContext.Response.Headers.Add("pagesQuantity", pagesQuantity.ToString());
          }
      }
  }
  </code></pre>
  
  <p>and this is my controller which uses this helper</p>
  
  <pre><code>using TranactionJournalV4.Helpers;
  using Microsoft.AspNetCore.Mvc;
  using Microsoft.EntityFrameworkCore;
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Threading.Tasks;
  using TranactionJournalV4.Models;
  using Microsoft.AspNetCore.Authorization;
  using Microsoft.AspNetCore.Authentication.JwtBearer;
  
  namespace TranactionJournalV4.Data
  {
      [ApiController]
      [Route("api/[controller]")]
      [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
      public class SearchService : ControllerBase
      {
          private readonly SqlDbContext context;
  
          public int Page { get; set; } = 1;
  
          public SearchService(SqlDbContext context)
          {
              this.context = context;
          }
          [HttpGet]
          [AllowAnonymous]
          public async Task&lt;List&lt;TransactionModel&gt;&gt; SearchTransactionsAsync(DateTime transactionDate, [FromQuery] PaginationDTO pagination)
          {
  
              var queryable = context.TransactionJournal.Where(s =&gt; s.TransactionDateTime &lt;= transactionDate).AsQueryable();
              await HttpContext.InsertPaginationParameterInResponse(queryable, pagination.QuantityPerPage);
              return await queryable.Paginate(pagination).ToListAsync();
          }
      }
  }
  </code></pre>
  
  <p>Now when I go through the code everything seems to be going great until it gets to the helper class my httpcontext seems to keep coming up as null. I cannot for the life of me seem to figure out why. Any help would be appreciated. Thanks!</p>