Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not use try catch to determine the BlazorServer running mode. #18224

Closed
maliming opened this issue Nov 22, 2023 · 0 comments · Fixed by #18226
Closed

Do not use try catch to determine the BlazorServer running mode. #18224

maliming opened this issue Nov 22, 2023 · 0 comments · Fixed by #18226
Assignees
Milestone

Comments

@maliming
Copy link
Member

maliming commented Nov 22, 2023

try
{
//Blazor tiered -- mode
var remoteServiceConfig = await RemoteServiceConfigurationProvider.GetConfigurationOrDefaultAsync("Default");
baseUrl = remoteServiceConfig.BaseUrl;
client.BaseAddress = new Uri(baseUrl);
AddHeaders(requestMessage);
await HttpClientAuthenticator.Authenticate(new RemoteServiceHttpClientAuthenticateContext(client,
requestMessage, new RemoteServiceConfiguration(baseUrl), string.Empty));
}
catch (AbpException) // Blazor-Server mode.
{
baseUrl = NavigationManager.BaseUri;
client.BaseAddress = new Uri(baseUrl);
foreach (var header in HttpContextAccessor.HttpContext!.Request.Headers)
{
requestMessage.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray());
}
}

@maliming maliming self-assigned this Nov 22, 2023
@maliming maliming added this to the 8.0-final milestone Nov 22, 2023
@maliming maliming removed their assignment Nov 22, 2023
@maliming maliming removed this from the 8.0-final milestone Nov 22, 2023
@maliming maliming reopened this Nov 22, 2023
@maliming maliming self-assigned this Nov 22, 2023
@maliming maliming added this to the 8.1-preview milestone Nov 22, 2023
@maliming maliming changed the title Use options instead of try catch to determine the BlazorServer running mode. Do not use try catch to determine the BlazorServer running mode. Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant