public BaseCommonLinkUtility( CoreBaseSettings coreBaseSettings, CoreSettings coreSettings, TenantManager tenantManager, IOptionsMonitor <ILog> options, CommonLinkUtilitySettings settings) : this(null, coreBaseSettings, coreSettings, tenantManager, options, settings) { }
public BaseCommonLinkUtility( IHttpContextAccessor httpContextAccessor, CoreBaseSettings coreBaseSettings, CoreSettings coreSettings, TenantManager tenantManager, IOptionsMonitor <ILog> options, CommonLinkUtilitySettings settings) { var serverUri = settings.ServerUri; if (!string.IsNullOrEmpty(serverUri)) { var uri = new Uri(serverUri.Replace('*', 'x').Replace('+', 'x')); _serverRoot = new UriBuilder(uri.Scheme, uri.Host != "x" ? uri.Host : LOCALHOST, uri.Port); _vpath = "/" + uri.AbsolutePath.Trim('/'); } else { try { HttpContextAccessor = httpContextAccessor; var uriBuilder = new UriBuilder(Uri.UriSchemeHttp, LOCALHOST); if (HttpContextAccessor?.HttpContext?.Request != null) { var u = HttpContextAccessor?.HttpContext.Request.GetUrlRewriter(); uriBuilder = new UriBuilder(u.Scheme, LOCALHOST, u.Port); } _serverRoot = uriBuilder; } catch (Exception error) { options.Get("ASC.Web").Error(error); } } CoreBaseSettings = coreBaseSettings; CoreSettings = coreSettings; TenantManager = tenantManager; }