You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then routing is strange, when I hit URL (for example https://localhost:5001/Settings) directly, it is not routed to Blazor page, but to the original webforms page. But when I click on its tab in the menu (Blazor part) it is routed correctly. Of course, when I remove @implements CancellableComponent from Blazor page, routing is correct in any circumstances.
How should I approach this situation, is there any chance of implementing my custom component base and having correct routing?
Many thanks
The text was updated successfully, but these errors were encountered:
I guess that possible solution to my problem coud be change of routing discovery to something like this:
using System;
using System.Collections.Generic;
using System.Reflection;
using Microsoft.AspNetCore.Components;
namespace ReCode.Cocoon.Proxy.Proxy
{
public static class BlazorRouteDiscovery
{
public static IEnumerable<string> FindRoutes(Type type)
{
var assembly = type.Assembly;
foreach (var exportedType in assembly.GetExportedTypes().Where(t => t.IsSubclassOf(typeof(ComponentBase)))
.Where(c => c.GetCustomAttributes(inherit: true).OfType<RouteAttribute>().Any()))
{
var routeAttribute = exportedType.GetCustomAttribute(typeof(RouteAttribute)) as RouteAttribute;
if (routeAttribute is null) continue;
yield return routeAttribute.Template;
}
}
}
}
Hello!
I'm trying to rewrite a legacy webforms app using Blazor server.
However, I'm having some problems with proxy routing.
Let's imagine ComponentBase class implementation such as this one:
and the component that is implementing it
Then routing is strange, when I hit URL (for example
https://localhost:5001/Settings
) directly, it is not routed to Blazor page, but to the original webforms page. But when I click on its tab in the menu (Blazor part) it is routed correctly. Of course, when I remove@implements CancellableComponent
from Blazor page, routing is correct in any circumstances.How should I approach this situation, is there any chance of implementing my custom component base and having correct routing?
Many thanks
The text was updated successfully, but these errors were encountered: