C
C#2y ago
TheTank20

❔ Output HTML from minimal API?

I'm trying to make an HTML file with code, which will be sent through. However, simply returning the HTML makes it look like text, instead of actually parsing it.
6 Replies
jcotton42
jcotton422y ago
probably the wrong Content-Type? check the network tab in browser dev tools, specifically the headers on the response
TheTank20
TheTank20OP2y ago
content type is text/plain how can I change that
jcotton42
jcotton422y ago
well first off why aren't you using asp.net mvc? it's kinda made for this otherwise, I'd say look into "asp.net minimal api response content type" or similar (my dinner's just about ready, so I need to drop)
TheTank20
TheTank20OP2y ago
99% of the project is handling video files the html's a one off thing
Angius
Angius2y ago
If it's just a plain static .html file, you can use the file serving middleware app.UseFileServer(); will serve all files from /wwwroot Place your index.html there and done
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.
Want results from more Discord servers?
Add your server