iFrame in PWA (Progressive Web App) - 2 calls for Offline - iframe

I am currently working on Progressive Web App.
I'm trying to create a PWA with an iFrame.
The problem is that I have to load the page twice, else that it can't be available offline.
Files are properlu cached on the first call but I realized that the fetch was only called for the second load. Is there a connection ?
If not, do you have any other idea where the problem might come from?
Thanks!

This is probably because of the waiting phase, check the lifecycle of service workers and how to skip the waiting phase.

Related

How to know from the client-side that a hot code push is occuring?

If I want to warn users that the application is updating (display a spinner...), I need to know when a hot code push is occurring, be it on a deployed or development app.
How to achieve this natively?
Is there any change to this specific event with the appcache package?

Updating an existing web app advice for asp.net

I have a web application that is used by several different clients. At the moment the process of updating their end with any changes is like so:
Publish/Compile App
Put relevant files into a zip (not web.config as different db paths for each client and don't want to overwrite)
Generate scripts on SQL Server for all Stored Procedures
Add to zip
Upload zip to Web
WPF App I created that runs from client server downloads zip, extracts files to web app folder and executes scripts for sql server stored procedures
Now this does work but it requires an IT guy at the client end to run the WPF App to update and it can be days before some of them get round to it. So what I would like to do is provide the ability to update the web app from WITHIN the web app. I know I can create a DLL to do the FTP, Extract etc, but how can I get this to display progress on the page?
Or if anyone has an alternative to updating the web app without the need for someone to access the server it's on great as this method makes it hard to let clients know when there is an update available.
You can use i.e.
[assembly: PreApplicationStartMethod(typeof(Your.Type), "MethodNameToCall")]
which is specified in the AssemblyInfo.cs file of a project to do some setup code whenever the application is deployed. This automatically runs on deployment and would allow you to do your copying/setup. You could probably run the WPF App from this code via
System.Diagnostics.Process
UPDATE:
Having re-read this post it seems clear to me that this is about moving from a WPF app to a web based app. Also it appears the poster just wants a method by which to signal back from the code that is updating the file system on the client side so....
Depending on how complex the input required is you may need one or more pages and a navigation system to go forward and back.
However once all input had been taken and the update commenced you have a couple of options - one 'hacky' the other not so.
1 - Hacky) Refresh the page using window.location javascript and setTimeout along with session tracking to update the progress of the threaded coded behind EWWWWW...
2) Create an ajax function using setInterval to poll the server (probably using a callable method decorated with the [WebMethod] attribute. This method can send back arbitrary data back to the ajax call which is then used to update the UI (perhaps using something like jqueryUI progress bar
NOTE: IF you are replacing anything in the bin, touching the web.config or in fact ANY .aspx page. Then you will restart the server automatically... If this is the case then you will have to code a seperate application that will update the other application from the outside + you should signal to any connected users that a shutdown will occur shortly and start blocking new users until the upgrade has completed.

Using a 3rd party COM dll in ASP.NET

I have an ASP.NET project using a COM dll. When I load the site, I login without a problem and I can browse the site fine as long as I don't go to a page which uses the COM library.
When I go to a page which uses the COM library to get data from a database, the page loads fine. The problem comes when I navigate away form this page. For some reason I am sent back to the login page as if the initial session was dropped.
If I take away the component on the page which displays the data which the library retrieves, I can navigate away from the page, so it is definitely the call to the library that kills the session.
Does anyone have any idea why this could happen??
Fixed it. It was a silly problem. The library created a log file in the bin directory every time it did something. The session gets dropped everytime there's a change in a file in the bin directory because the AppDomain gets destroyed and restarted.
I wonder if the COM component crashes and tears down your application pool (or whatever it's called these days in ASP.NET).
Can you keep an eye on the ASP.NET worker process (it used to be called aspnetwp.exe) and see if it disappears when you navigate to the page with the COM calls?
If so, the COM component probably throws a structured exception, which terminates the process, causing your session state to be lost, if you store it in-process on the server.
You might be able to glean more information from the Event Viewer (Start -> Run -> eventvwr), where ASP.NET logs any crashes.

In a .Net web site, what are my options for sending email alerts when folder contents change?

I don't know much about the .Net environment, so my first idea was to just write a console app that scans the folder for new content, and then emails alerts out. Then put the .exe as a scheduled task on the server, executing every few minutes. This seems pretty archaic to me though. Is there a more elegant way to do this for my website?
No matter what type of application you choose the way to get notifications about folder changes in .NET is through the FileSystemWatcher class. A good approach would be to create a Windows Service which will run in background and listen for notifications.
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx
You can use the FileSystemWatcher. Create a Windows Service that constantly runs, and attach an Event to the Watcher to send out emails.
Note that this reports every change, sometimes multiple ones (e.g., moving a file is a delete and create I think), so you may want to limit the number of emails you sent. Experiment a bit before sending hundreds of emails or so - been there, done that :)

Running a web app automatically

I have an asp.net update web app. Users go the the page, hit the update button and the program runs. We also want this program to run as a scheduled task everynight. Is this possible? How would you handle this?
thanks
You could create a shortcut on your program to a page on your web app (say update.aspx?command=update) and then have your server's scheduler set to run that shortcut at the time you wish.
I would only recommend that you use a page which has nothing on it and will only respond to a specific command, that way you lower the risk of your page being "tripped" when you don't want it to be.
A better way would be to break the application up into a domain layer dll, then your aspx page could use that dll, and you could also write a console app that used the same dll. You could setup a scheduled task to run the console app nightly.

Resources