Search code examples
c#razorblazorwebassembly

Blazor Webassembly how to display plain text on a page (Loader.io)


I want to verify my blazor webserver for loader.io, for that i need to create a page with a specific name and a specific token(text) which isn´t wrapped in html.

On my blazor server i solved this with an apicontroller which returns the plain text like that (no real token):

[ApiController]
    public class ControllerIO: ControllerBase
    {
        [HttpGet("loaderio-43894353475834598")]
        public IActionResult Verify()
        {
            var response = new HttpResponseMessage(HttpStatusCode.OK);
            response.Content = new StringContent("loaderio-43894353475834598", Encoding.UTF8, "text/plain");
            return new OkObjectResult("loaderio-43894353475834598");
        }
    }

How could this be done in blazor webassembly?


Solution

  • Create a loaderio.txt file or serve an endpoint without blazor. you should not use blazor at all.