Skip to content

UriHelper cannot be used to navigate to non-Blazor URIs in server-side #11099

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

Closed
rynowak opened this issue Jun 11, 2019 · 2 comments
Closed

UriHelper cannot be used to navigate to non-Blazor URIs in server-side #11099

rynowak opened this issue Jun 11, 2019 · 2 comments
Labels
area-blazor Includes: Blazor, Razor Components question

Comments

@rynowak
Copy link
Member

rynowak commented Jun 11, 2019

Repro

Create a new server-side Blazor app (with auth).

Try to use IUriHelper.NavigateTo("Identity/Account/Login") (make a button).

It will go to the Not Found page instead of doing an actual navigation. However, making an <a href> with the same URL will navigate to the login page.

Using preview 6

@rynowak rynowak added area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. labels Jun 11, 2019
@pranavkm
Copy link
Contributor

Does the Router have a NotFoundContent set? We specifically choose to show you the NotFoundContent if the navigation was started programatically (via NavigateTo) and the route that could not be addressed.

The pivot here is that NavigateTo is meant for navigating within the component route-space. You could use NavigateTo("...", force) to force a browser redirect without the router being involved.

@rynowak
Copy link
Member Author

rynowak commented Jun 13, 2019

Ah sorry. I'm a blazor noob. Thanks for the help.

@rynowak rynowak closed this as completed Jun 13, 2019
@rynowak rynowak added question and removed bug This issue describes a behavior which is not expected - a bug. labels Jun 13, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components question
Projects
None yet
Development

No branches or pull requests

2 participants