Error accessing local resources #516

Closed
opened 2026-01-29 16:41:43 +00:00 by claunia · 3 comments
Owner

Originally created by @SimonSchoeni on GitHub (Jun 18, 2020).

Originally assigned to: @GregorBiswanger on GitHub.

Hello!

I'm currenlty using to Electron.NET to host an ASP MVC application. This application should be capable of displaying videos.

The videos are imported using the file:///c:/local.../ format.
Whenever I try to access the video chromium tells me that it is not able to load the local resource: "Not allowed to load local resource: file///c:/local.../"...

When starting up electron, it uses the following options:
var options = new BrowserWindowOptions() { WebPreferences = new WebPreferences() { WebSecurity = false } }; await Electron.WindowManager.CreateWindowAsync(options);
As far as I understand this, the turned off WebSecurity feature should allow the underlying chromium to load local resources.... Is there anything else I may have forgotten to check?

Originally created by @SimonSchoeni on GitHub (Jun 18, 2020). Originally assigned to: @GregorBiswanger on GitHub. Hello! I'm currenlty using to Electron.NET to host an ASP MVC application. This application should be capable of displaying videos. The videos are imported using the `file:///c:/local.../` format. Whenever I try to access the video chromium tells me that it is not able to load the local resource: "Not allowed to load local resource: file///c:/local.../"... When starting up electron, it uses the following options: ` var options = new BrowserWindowOptions() { WebPreferences = new WebPreferences() { WebSecurity = false } }; await Electron.WindowManager.CreateWindowAsync(options);` As far as I understand this, the turned off WebSecurity feature should allow the underlying chromium to load local resources.... Is there anything else I may have forgotten to check?
claunia added the bug label 2026-01-29 16:41:43 +00:00
Author
Owner

@GregorBiswanger commented on GitHub (Jun 18, 2020):

It should normally be sufficient to just deactivate WebSecurity. Possibly. do you want to access a directory without direct access? Have you already run the Electron app as admin? For test only? Did you test the path without an electron?

I would always have the path put together by tools so that it remains a cross-platform.. Use Path.Combine..

@GregorBiswanger commented on GitHub (Jun 18, 2020): It should normally be sufficient to just deactivate WebSecurity. Possibly. do you want to access a directory without direct access? Have you already run the Electron app as admin? For test only? Did you test the path without an electron? I would always have the path put together by tools so that it remains a cross-platform.. Use `Path.Combine`..
Author
Owner

@SimonSchoeni commented on GitHub (Jun 19, 2020):

Hi!

I have access to the directories since I used Electron to save data in the same directory.

I didn't really bother to run electron as admin since it should not be required since I'm able to store data to the directory.

I opened the file:/// link in chrome and I saw the file.

Thanks for the advice, I already use Path.Combine etc. :)

BR Simon

@SimonSchoeni commented on GitHub (Jun 19, 2020): Hi! I have access to the directories since I used Electron to save data in the same directory. I didn't really bother to run electron as admin since it should not be required since I'm able to store data to the directory. I opened the file:/// link in chrome and I saw the file. Thanks for the advice, I already use Path.Combine etc. :) BR Simon
Author
Owner

@GregorBiswanger commented on GitHub (Mar 28, 2023):

🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉

With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!

@GregorBiswanger commented on GitHub (Mar 28, 2023): 🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉 With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#516