I have a .NET 4.8 project with an iframe inside of a main window. We use window.postMessage so that the frame can minimize a sidebar when a specific page is loaded.
This works just fine when hosted at our local data center, but not on Azure. We migrated to Azure and have the project running in App Services.
Does anyone know of a place to start to figure out why this would be blocked?
I don't get any error messages in the console and haven't found any logs to suggest this is being blocked by CORS, a firewall, or the application gateway.
This is the code that is called to close the sidebar and the event listener:
window.postMessage("<name of function>", window.document.referrer);
$window.on("<name of function>", _bind(this.<name of function>, this));
I've tried the following without success:
window.postMessage("<name of function>", window.location.origin);
localStorage.setItem('customEvent', '<name of script>');
const parentWindow = window.parent;
parentWindow.postMessage("<name function>", window.location.origin);
I also tried adding custom headers in the Startup.cs file, as well as web.config, without success.
Thank you!
I deployed a .net 4.8 webform application with an iframe in the main page to Azure App Service, and it was successful.
I used the following codes to send message and minimize the sidebar.
Default.aspx :
PageInIframe.aspx :
I successfully deployed it to the Azure App Service using Visual Studio.
Azure App service Output :
After deployment, I can see the message and sidebar minimization without any issues,
and I have restored the sidebar.