Reputation: 1
How can I make users use server side for the first time visit website and then be wasm after that
And idea if this works?
Upvotes: 0
Views: 56
Reputation: 198
I don't think there's a simple solution for this since the site that the user hits is whatever the server serves up to the client. So it either serves up a Blazor WASM site, or a Blazor Server site. I'm not sure why you'd want to do this, but I guess you could build your application that you need in Blazor Server, and have that work as your main site, then have it store a value in the localstorage or something that you attempt to read in every time the application is loaded and if it finds the value that you need (indicating that the user has visited the site before) then you force a redirect to another site that serves up your Blazor WASM site. The issue with this is that essentially you are building the website twice and hosting it on 2 separate websites. I'm not an expert with URL routing but there may be a way to have it cache the redirect so that everytime after the first time it will automatically redirect to your WASM site making it load faster after the first redirect occurs.
This might not be the best answer or even what you were hoping for, but maybe if you gave a little more information as to why you would need to do this in the first place, I could help out a little more.
Upvotes: 1