Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

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

$
0
0

I have 2 apps. For this sake, lets call it 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 paramaters.

@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 = $"https://xxx.azurewebsites.net/externalauth/{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 - https://xxx.azurewebsites.net/externalauth/oaXpoCd6ymd4bKfLNYd8K5RVnAikn8hU%252BBxkuAXVL9dmN5XFk8tAsHnL9Uir4q6i%252FdUDJb1YwBO6P6de5koJs7mslD0lnwORHACLcneenTfl5eiwENIAsi4hkiA%252Bop20/n3P8LR1PQPkROlih5O1uVRMWaoN4xqo%252BFW41mUUpagS73wExcOhhkgv5uH0FLA9ec


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>