Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

.NET 8 Blazor web app can't access PDF from server or local network

$
0
0

I'm trying to open a PDF file from an absolute path, when in debugging I can open it from both local network and the server I'm running the web app. But as soon as I host it in IIS, it can't access the PDF anymore (doesn't matter if it's local or on local network).

I'm using localsystem as identity since it has the highest permissions and the folder that has the PDF, every account I have has access to it, but still can't open it.

Any ideas what I'm doing wrong? I know it has to do with permissions - I just don't know where else to look.

@code {    string filepath = @"c:\\users\myusers\myfolder\ + filename;    byte[] fileBytes = await File.ReadAllBytesAsync(filepath);    string base64 = Convert.ToBase64String(fileBytes);    string dataUri = $"data:application/pdf;base64,{base64}";    await JSRuntime.InvokeVoidAsync("eval", $@"    var win = window.open();    win.document.write('<iframe src=""{dataUri}"" frameborder=""0"" style=""border:0; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%;"" allowfullscreen></iframe>');");}

This is where I'm trying to open the PDF and the filename is the result of a query.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>