c# - Why does my Azure-deployed web app throw a 'resource not found' error, while it works fine on localhost? -

I have 2 apps - let's call them App1 and App2.Both are Blazor server projects. From App1, we pass

I have 2 apps - let's call them App1 and App2.

Both are Blazor server projects. From App1, we pass through user identity data to authenticate with in App2.

The endpoint in App2 is a component named ExternalAuth accepting 2 parameters:

@page "/externalauth/{EncryptedData}/{EncryptApiKey}"
@using FinnivoClients_BlazorServer.Services
@inject NavigationManager NavigationManager
@inject ExternalAuthService ExternalAuthService

@code {
    [Parameter] public string EncryptedData { get; set; }
    [Parameter] public string EncryptApiKey { get; set; }

    protected override async Task OnInitializedAsync()
    {
        if (string.IsNullOrEmpty(EncryptedData) || string.IsNullOrEmpty(EncryptApiKey))
        {
            NavigationManager.NavigateTo("/");
            return;
        }

        bool isAuthenticated = await ExternalAuthService.AuthenticateExternalUser(EncryptedData, EncryptApiKey);

        if (isAuthenticated)
            NavigationManager.NavigateTo("/", forceLoad: true);
        else
            NavigationManager.NavigateTo("/error");
    }
}

In App1, it is just a simple button click to redirect to this address:

private async Task RedirectToClientApp()
{
    // Only encode the values once
    string targetUrl = $"/{encodedData}/{encodedKey}";

    // Open the URL in a new tab
    NavigationManager.NavigateTo(targetUrl);
}

The issue is when we use the live azure link, I get the following error -> The resource you are looking for has been removed, had its name changed, or is temporarily unavailable

When using localhost to test on it works perfectly, example:

private async Task RedirectToClientApp()
{
    // Only encode the values once
    string targetUrl = $"https://localhost:8080/externalauth/{encodedData}/{encodedKey}";

    // Open the URL in a new tab
    NavigationManager.NavigateTo(targetUrl);
}

It even works when I edit take the encoded values and pass it to the localhost link.

What can the cause be, and what can I do to sort this issue?

I tried changing the encoding, and tested various scenarios from taking the last part of the url, and passing it into the localhost link.

Example url - /n3P8LR1PQPkROlih5O1uVRMWaoN4xqo%252BFW41mUUpagS73wExcOhhkgv5uH0FLA9ec

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744846466a4596868.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信