Description
Hi
When i update my project from 8 to 9 blazor and use new feature @assets[""]
but when run project and see inspect , dont cach the static files
MainLayout :
<link rel="stylesheet" href="http://github.com/@Assets["/client-assets/css/vendors/bootstrap.rtl.css"]" id="rtl-link"> <link rel="stylesheet" href="http://github.com/@Assets["/client-assets/css/animate.min.css"]"> <link rel="stylesheet" href="http://github.com/@Assets["/client-assets/css/custom.css"]"> <link rel="stylesheet" href="http://github.com/@Assets["/client-assets/css/bulk-style.css"]"> <link rel="stylesheet" href="http://github.com/@Assets["/client-assets/lib/swiper/swiper-bundle.min.css"]"> <link rel="stylesheet" href="http://github.com/@Assets["/client-assets/css/style.css"]">
Program.cs
`
using HtmlRenderer = Microsoft.AspNetCore.Components.Web.HtmlRenderer;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents()
.AddInteractiveWebAssemblyComponents();
builder.Services.AddCascadingAuthenticationState();
builder.Services.AddScoped<IdentityUserAccessor>();
builder.Services.AddScoped<IdentityRedirectManager>();
builder.Services.AddScoped<AuthenticationStateProvider, PersistingRevalidatingAuthenticationStateProvider>();
builder.Services.AddAuthentication(options =>
{
options.DefaultScheme = IdentityConstants.ApplicationScheme;
options.DefaultSignInScheme = IdentityConstants.ExternalScheme;
})
.AddIdentityCookies();
builder.Services.AddAuthorization();
builder.Services.AddSignalR(hubOptions =>
{
hubOptions.MaximumReceiveMessageSize = 1024000; // Example size limit in bytes
});
// Add Identity services
builder.Services.AddIdentityCore<ApplicationUser>(options =>
{
// Set password requirements
options.SignIn.RequireConfirmedAccount = true;
options.Password.RequireDigit = true; // Remove the need for a digit
options.Password.RequireLowercase = false; // Remove the need for a lowercase character
options.Password.RequireUppercase = false; // Remove the need for an uppercase character
options.Password.RequireNonAlphanumeric = false; // Remove the need for a non-alphanumeric character
options.Password.RequiredLength = 6; // Set the minimum password length to 6 characters
})
.AddRoles<ApplicationRole>() // Enables role management
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddSignInManager()
.AddRoleManager<RoleManager<ApplicationRole>>() // Correct usage
.AddDefaultTokenProviders();
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");
builder.Services.AddDbContextFactory<ApplicationDbContext>(options => options.UseSqlServer(connectionString));
builder.Services.AddDatabaseDeveloperPageExceptionFilter();
builder.Services.AddServerSideBlazor()
.AddHubOptions(options =>
{
options.KeepAliveInterval = TimeSpan.FromSeconds(10);
});
//builder.Services.AddScoped<AuthenticationStateProvider, CustomAuthStateProvider>();
//builder.Services.AddScoped<CustomAuthStateProvider>();
builder.Services.AddBlazoredLocalStorage();
builder.Services.ConfigureApplicationCookie(options =>
{
options.ExpireTimeSpan = TimeSpan.FromMinutes(30); // Set to whatever duration you prefer
options.SlidingExpiration = true;
options.Cookie.HttpOnly = true;
options.Cookie.SameSite = SameSiteMode.None;
options.Cookie.SecurePolicy = CookieSecurePolicy.Always; // Ensure cookies are only sent ove
});
builder.Services.AddHttpContextAccessor();
builder.Services.AddServerSideBlazor().AddCircuitOptions(option => { option.DetailedErrors = true; });
builder.Services.Configure<RouteOptions>(options =>
{
options.AppendTrailingSlash = false;
options.LowercaseUrls = true;
options.LowercaseQueryStrings = true;
});
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseWebAssemblyDebugging();
app.UseMigrationsEndPoint();
}
else
{
app.UseExceptionHandler("/Error", createScopeForErrors: true);
// 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.UseDeveloperExceptionPage();
app.MapRazorPages();
app.UseHttpsRedirection();
app.UseRouting();
app.MapStaticAssets();
app.UseAuthentication();
app.UseAuthorization();
app.UseResponseCompression();
app.UseStatusCodePagesWithRedirects("/404");
app.UseAntiforgery();
app.MapAdditionalIdentityEndpoints();
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode()
.AddInteractiveWebAssemblyRenderMode()
.AddAdditionalAssemblies(typeof(MasterDev.Client._Imports).Assembly);
app.Run();
`
in docs show the files in page source like this :
but in my project show like this
why my static files dont cached and dont have hash string ?