Blazor webassembly shows 405 error in localhost (and also when deployed to iis) when redirect back from payment website

Jayant Guru 0 Reputation points
2023-01-27T11:08:51.96+00:00

I have created a blazor webaseembly project using .net 7. The blazor app redirects to an external url for payment. Once payment is done the payment status page(which is in the blazor app) should be loaded as that's the return url set while calling the payment gateway. However, when the payment status page is showing HTTP ERROR 405. Need urgent help.

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,396 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 56,686 Reputation points
    2023-01-27T20:51:02.57+00:00

    redirecting to the payment gateway will unload the blazer app. the blazor app should save any required state before the redirect. the reply url to the payment gateway should be a valid blazor page. when this page loads it should restore state.

    if the gateway responds with a post, then the reply url should be an action on the host for the blazor app. after processing the post data, it should redirect to the blazor page.

    0 comments No comments

  2. Jayant Guru 0 Reputation points
    2023-02-09T10:45:57.9666667+00:00

    Finally was able to fix the issue. The payment gateway return url should be an endpoint in API rather than blazor application. Once the return url lands in the API then load the blazor application from the API using RedirectPermanent.

    return RedirectPermanent("https://yourblazorwebsite/paymentstatus");

    Here I wanted to show the payment status to user after the payment is done. So I used the RedirectPermanent method inside my API. The blazor application then loads the payment status page with all state intact.


  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  4. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more