-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Blazor-server-side Multi routing such as in mvc #37485
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
Comments
@Alerinos thanks for contacting us. This is already possible today provided that you host your apps in different base paths. Here is a sample I wrote a while ago that you can use as a starting point. It's for Blazor webassembly, however you should be able to adapt it for Blazor server without much trouble. |
I didn't really mean it. The application is shared, but large sites have several sections.
@javiercn I don't think your example will work that well |
@Alerinos it's not clear to us what you are trying to achieve. Are you looking for something similar to Areas in MVC? |
@javiercn |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
@Alerinos, I believe that the Router's OnNavigateAsync feature can solve your issue. Here's a simple code sample, checking the url path and navigating to the required url. This fulfills what you requested at the start of your question. I believe you can create a well-grained and complex navigation scheme. You can also query your database through Web Api end points, etc. See here the docs and follow the explanations: App.razor
|
@enetstudio Unfortunately that won't work, it will only create a redirect. For this to work, you need to use the @pranavkm @javiercn Maybe it's worth taking a look at a custom router in .net 7? It is very useful. |
Example: app.UseEndpoints("/{name}",endpoints =>
{
endpoints.MapControllerRoute(() => {
if(db.ToDo.Any(x => x.Name == endpoints.name))
RenderHandle.Redner(Pages.Counter)
}
);
endpoints.MapControllerRoute(() => {
if(db.Weather.Any(x => x.ShortName == endpoints.name))
RenderHandle.Redner(Pages.Fetchdata)
}
);
// OR
endpoints.MapControllerRoute(() => {
if(db.Weather.Any(x => x.ShortName == endpoints.name))
RenderHandle.Redner(Pages.Fetchdata, endpoints.name) // Add One Get parameteres
}
);
}
); Database:
If we type |
Recently, I brought up this topic here #39719 |
Hi. Thanks for contacting us. |
I have two sides
I would like many sites to be able to run under one domain like in mvc
example:
in mvc it was enough to give
return NotFound();
The text was updated successfully, but these errors were encountered: