-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
✔️ Resolution: AnsweredResolved because the question asked by the original author has been answered.Resolved because the question asked by the original author has been answered.Blazor ♥ SignalRThis issue is related to the experience of Signal R and Blazor working togetherThis issue is related to the experience of Signal R and Blazor working togetherStatus: Resolvedarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Componentsfeature-blazor-serverquestion
Description
I'm using windows authentication but there are pages that are accessible by everyone. I allow anonymous by adding this @attribute [Authorize, AllowAnonymous] to _Hosts.cshtml.
Problem: Although the page still loads, since the websocket disconnects, all blazor events such as @onclick, @bind no longer work.
Expected behavior:
The user is not allowed to view Authorized pages however anonymous page should be visible and have all blazor events working.
Program.cs
`
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
Configuration = builder.Configuration;
// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddHttpClient();
builder.Services.AddControllers();
builder.Services.AddHttpContextAccessor();
// Add services to the container.
builder.Services.AddAuthentication(NegotiateDefaults.AuthenticationScheme)
.AddNegotiate();
builder.Services.AddAuthorization(options =>
{
// By default, all incoming requests will be authorized according to the default policy.
options.FallbackPolicy = options.DefaultPolicy;
});
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
//app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapFallbackToPage("/_Host");
endpoints.MapBlazorHub();
});
app.Run();
}
}
`
Metadata
Metadata
Assignees
Labels
✔️ Resolution: AnsweredResolved because the question asked by the original author has been answered.Resolved because the question asked by the original author has been answered.Blazor ♥ SignalRThis issue is related to the experience of Signal R and Blazor working togetherThis issue is related to the experience of Signal R and Blazor working togetherStatus: Resolvedarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Componentsfeature-blazor-serverquestion
