'What to use instead of HttpContext.Current in .net 6?

I used this in .net 6 but it is not working

{
    string PageUrl = HttpContext.Current.Request.Url;
    
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source