-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
InvalidOperationException
occurs on onsubmit
event when using NavigateTo
method with non-ASCII characters on Blazor SSR render mode.
#52438
Comments
I tested it on additional platforms.
|
@javiercn private void NavigateToWithNonASCIIParameter() =>
NavigationManager.NavigateTo($"navtarget?text={Uri.EscapeDataString("😀")}"); |
When I noticed this error, I used |
@javiercn I apologize for the consecutive replies. @page
@model IndexModel
@{
ViewData["Title"] = "Home page";
}
<form method="post">
<input type="submit" />
</form> using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace WebApplication29.Pages;
public class IndexModel : PageModel
{
private readonly ILogger<IndexModel> _logger;
public IndexModel(ILogger<IndexModel> logger)
{
_logger = logger;
}
public void OnGet()
{
}
public IActionResult OnPost()
{
// NG
// return Redirect("next?text=😀");
// OK
return Redirect($"next?text={Uri.EscapeDataString("😀")}");
}
} However, this issue occurs even if I use encoded URL. There is not workaround. So I guess it is blazor specific issue. |
Is there an existing issue for this?
Describe the bug
InvalidOperationException
occurs ononsubmit
event when usingNavigateTo
method with non-ASCII characters on Blazor SSR render mode. Only ASCII case works fine.The error page:

The stack trace:
Expected Behavior
Navigating works without error.
Steps To Reproduce
Scratch
Components/Pages/Home.razor
like below:Use a repro project
I created a sample project for repro.
https://github.com/runceel/NoAsciiError
NavigationManager.NavigateTo("navtarget?text=😀")
button.Exceptions (if any)
No response
.NET Version
8.0.100
Anything else?
I faced the error when implement a search page like Bing and Google.
Those pages have a textbox and a submit button. And then search result page has search key words in query parameters.
If search key worlds are non ASCII characters such as Emoji and Japanese and other languages, the error occurs.
I guess it is a serious blocker to use Blazor SSR mode.
The text was updated successfully, but these errors were encountered: