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

Blazor .NET 8 Automatic Logout on Plesk Hosting #60533

Open
MahdiElahi opened this issue Feb 21, 2025 · 5 comments
Open

Blazor .NET 8 Automatic Logout on Plesk Hosting #60533

MahdiElahi opened this issue Feb 21, 2025 · 5 comments
Labels
area-security Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update.

Comments

@MahdiElahi
Copy link

Hello everyone,

I have created a Blazor .NET 8 project and deployed it on a Plesk hosting panel. However, I’m facing an issue where the user is automatically logged out after 40–50 seconds.

This problem does not occur on localhost, only on the hosted version.

I have tried modifying session and cookie timeout settings in Program.cs, but the issue persists.

Here is my Program.cs configuration:
GitHub Link

Does Blazor require any specific settings on Plesk? Or should I make any additional changes?

Any help would be appreciated. Thanks!

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Feb 21, 2025
@javiercn
Copy link
Member

@MahdiElahi thanks for contacting us.

Does the same problem happen if you use an MVC application instead of Blazor?

@javiercn javiercn added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Feb 21, 2025
@MahdiElahi
Copy link
Author

@javiercn
Yes i test it in mvc have this problem too.
i publish mvc project on server you can create user and test it ?
[https://sofalbozhgan.com/Home/Privacy](My website)

@dotnet-policy-service dotnet-policy-service bot added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Feb 21, 2025
@MahdiElahi
Copy link
Author

MahdiElahi commented Feb 21, 2025

@javiercn
i test it and have this problem in mvc .net 9 too ( just create new project mvc without any change)
i publish on server and you can test it ( register user and login)
you can test it
MyWebsite

@javiercn javiercn added area-security and removed area-blazor Includes: Blazor, Razor Components Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. labels Feb 21, 2025
@halter73
Copy link
Member

It could be that the keys used to encrypt and decrypt your authentication cookies are getting lost when the underlying container hosting your application gets spun down. If you enable data protection logging, do you see anything like the following?

Storing keys in a directory '{path}' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed. For more information go to https://aka.ms/aspnet/dataprotectionwarning

The good news is you have a lot of control over how keys are stored. https://learn.microsoft.com/aspnet/core/security/data-protection/configuration/overview?view=aspnetcore-8.0 should demonstrate how you can store the keys in a location that you know will be persisted long term like a database or a shared volume.

If it's not a data protection issue, I recommend turning on all debug level logs and providing those. Hopefully that shouldn't be too much if the issue only takes 40-50 seconds.

@halter73 halter73 added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Feb 21, 2025
@MahdiElahi
Copy link
Author

i add "Microsoft.AspNetCore.DataProtection": "Information"

but what i do now ?
how to solve this problem ?

@halter73
@javiercn

@dotnet-policy-service dotnet-policy-service bot added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-security Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update.
Projects
None yet
Development

No branches or pull requests

3 participants