I want to use an iframe in my Blazor server app to display PDF resources. I have used UseStaticFiles middleware to serve the resouce location to iframe, but it does not work.
Here is the code snippets, where test.pdf has been placed in “C:tempCRMStatictemppdftest.pdf” :
program.cs
”’
app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(@"c:tempCRMStatic"),
RequestPath = "/Static",
});
”’
page.razor
”’
<iframe src="temp/pdf/test.pdf"></iframe>
”’
Can anyone tell me, what is my mistake?