Created
September 3, 2019 13:00
-
-
Save ntakouris/8d90c64f662c6309d188b91beb48a76e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services.AddSingleton<IUriService>(provider => | |
{ | |
var accessor = provider.GetRequiredService<IHttpContextAccessor>(); | |
var request = accessor.HttpContext.Request; | |
var absoluteUri = string.Concat(request.Scheme, "://", request.Host.ToUriComponent(), "/"); | |
return new UriService(absoluteUri); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment