'Building Offline capabilites in ASP.NET Core web application

We are building a project management web application using those main technologies:-

  1. ASP.NET Core MVC
  2. SQL Server + Entity Framework
  3. HTML, CSS & Bootstrap

The application mainly allows to create project >> create tasks under the projects >> assign Task to users >> and so on..

Now part of the requirement is to have certain areas that should be available offline as follow:-

  1. My Tasks dashboard. which shows the Tasks assigned to the login user. so even if the user does not have internet access >> the dashboard should list all the Tasks assigned to the user when the user was last online.

  2. Complete a task, by entering some fields and upload images. so even if the user does not have internet access >> the user should be able to click on a Task inside the dashboard >> fill the completion sections >> upload images/files >> click on submit >> the data should stay offline, and get submitted automatically once the user has internet access.

So can we have those offline features available inside our web application ? also some users will be accessing the web application inside their mobile web,, so are mobile browser capable of storing data and attachments and allow them to access the dashboard + edit a task and complete it and submit the change offline ? or we will need to have a mobile application instead?

Thanks



Solution 1:[1]

In principle, offline capabilities are available in every browser. These include things like localStorage, IndexedDB (parts of any browser), and progressive web apps (PWA) option (service workers). Note: PWA manifest and service workers are not actually related to or require blazer (mentioned above) in any way, they are web standard basically, don't get confused here. Blazer is a separate thing altogether.

The older technologies to support offline also include "application cache" mentioned in the other answer (NOTE: this one has been deprecated in favor of PWA, and support for it has been removed from Google Chrome for example)

Practically, all this means that every browser has an offline database/storage available for every application to store its data offline and synchronize later on. So, you don't have to build a mobile app to have offline capabilities.

There are some frameworks and platforms that could help you build offline-capable applications, but asp.net core mvc is not exactly one of those, meaning it does not provide offline capability right out of the box. That is, there is no checkbox to click, as far as I know, of course.

Solution 2:[2]

You use ASP.NET Core MVC and Entity Framework, and I think it not support offline capabilites. Because this project is compiled and run on the server.

If you want the application to support offline functions, I think it should be possible to download the entire content of the site to the browser locally.

You can refer to the official documentation below.

ASP.NET Core Blazor Progressive Web Application (PWA)

The following documents, I know are not ASP.NET Core MVC projects, but for reference.

I think to achieve offline function, first of all, the content of the complete site needs to be downloaded to the local when it is accessed for the first time. In this way, there will be no network exception errors when accessing offline.

Build an HTML5 Offline Application with Application Cache, Web Storage and ASP.NET MVC

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Jason