I am currently working on two projects. The first project is an ASP.NET web project, and the second project involves an embedded HTTP server library.
The embedded HTTP server project was sourced from: embedded http server project
My goal is to enable users to save a video file from their local device to shared storage. I have been attempting to achieve this by getting and sending files from the browser using AJAX requests. The embedded HTTP server is responsible for receiving byte arrays and saving the video file to the client's shared storage. However, I have encountered a persistent issue that I have yet to resolve despite spending several days on it.
In Google Chrome, the process gets stuck at stream.CopyTo(streamReader);
.
In Firefox and Internet Explorer, an error message stating "Cross-Origin Request Blocked" is displayed. Despite the error, Firefox successfully saves the file.
Below is the code snippet for the AJAX request:
[AJAX request code here]
And here is the code snippet for the embedded server to handle the request:
[Embedded server code goes here]
Additionally:
For Internet Explorer: Enabling "Access data sources across domains" in the security settings allows the process to work without errors.
For Google Chrome: Starting Chrome with the --disable-web-security parameter
resolves the issue, but I am looking for a solution within the code itself.