C
C#2y ago
mindhardt

✅ Access wwwroot in Blazor wasm razor

I have a blazor hosted project and a file in a wwwroot folder. This file needs to be accessed by razor component's C# code but I can't find any help googling. Right now this file is getting loaded from server but this is redundant since it is static.
5 Replies
mindhardt
mindhardt2y ago
I want this file to be included in client project and loaded from there, I know I can access them via HTML, but can razor do the same? I need file content
Monsieur Wholesome
You're using asp.net core to hort it?
Monsieur Wholesome
From what I can gather, you'd add the UseStaticFiles statement in your startup.cs/program.cs And make an http request to your wwwroot resource https://learn.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-7.0
Static files in ASP.NET Core
Learn how to serve and secure static files and configure static file hosting middleware behaviors in an ASP.NET Core web app.
Monsieur Wholesome
As in js you'd do the same
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity. Closed!
Want results from more Discord servers?
Add your server
More Posts
Why is this so complicated? (Sending an email using SendGrid)Why isn't it as simple as sending a POST request to their API? https://learn.microsoft.com/en-us/as✅ Why is rng not working?https://docs.google.com/document/d/1r9a7-K_GiWhBarvFvC_fvRdVF9cziu05_HXtAk1gu_k/edit?usp=sharing The✅ Connecting desktop client to a web app. How to link the session via SignalR?Hello. I am trying to design a new project. I need to build a client to run on user's desktops. This✅ while loop help(im new ish so its probs obvious)'''cs namespace HippityHop { internal class Program { static void Main(string[] args❔ Upgrading a solution from .net core 3.1 to .net 6.0Hi guys, I am upgrading a old solution from .net core 3.1 to 6.0 and I am facing some issues, not suIdentity SQL errorLast 2 commits have the relevant code: https://github.com/dzenis-zigo/Frizerski-Salon-ML/commits/maiHow do i stop dotnet from adding Debug net6.0 subfolder to my output path?I'm making a project with plugin system, and I need the output path to be exactly the one I specify,Help setting up ASP.NET Core Identity and SQL Server``` using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using SalonML_API.Data; usi✅ Variables from different classes not adding upHello my name is Peter and i would like to ask for your help. In my code, i am unable to add variabl❔ Predefined type is not defined when using dotnet-scriptI'm getting an error for `System.Object` and `System.String` that they're not imported when creating