Skip to content
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

Why does the page automatically redirect to "/Account/Login" when the user is not authorized? #58848

Closed
WillowTree1184 opened this issue Nov 9, 2024 · 2 comments
Labels
area-blazor Includes: Blazor, Razor Components ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. question Status: Resolved

Comments

@WillowTree1184
Copy link

WillowTree1184 commented Nov 9, 2024

I have created a Blazor Web App project in auto render mode and added a nuget package Microsoft.AspNetCore.Authorization in version 8.0.10.

But when I added [Authorize] attribute to my page, I don't know why that it will automatically redirect to "/Account/Login" when the user is not authorized, even though there is no handler for this route. I would like the page to redirect to "/auth/signin" instead, what should I do?

My dotnet version is 8. I develop it in Visual Studio 2022.

Thank you for your time and assistance.

PS: I will upload my code later.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Nov 9, 2024
@javiercn
Copy link
Member

@WillowTree1184 thanks for contacting us

Are you using cookies? If that is the case it's because the default challenge for cookies is to redirect to that URL. You can change the path in the cookie options.

@javiercn javiercn added question ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. labels Nov 11, 2024
Copy link
Contributor

This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes.

See our Issue Management Policies for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. question Status: Resolved
Projects
None yet
Development

No branches or pull requests

2 participants