Make ASP.Net (C#) Web App Available Offline
Asked Answered
H

1

6

I have been tasked with making my company's Web App available offline. Before I move to the actual development phase, I want to be sure that my current strategy will not turn out to be a bust.

I first thought about using html5 app cache but after doing some tests I found that it seems to not cache the server side operations but the actual html that is rendered (Please correct me if I'm wrong). This will not work because the rendered html depends upon who is currently logged in. From my tests, it always rendered the html as if the last person that logged in (online) is logging in.

My current strategy is this: I cache only the login page and an offline (.html) page to correspond to each aspx page that will need to be available offline. Every successful login (online) results in creating or updating Web SQL Database or IndexDB (depending on browser) with all data needed for that person to operate offline including a table that will be used for login credentials. In this way the only requirement for logging in offline is logging in with your login credentials at least one time.

My concern is that I am overcomplicating it. In order to make this work, I will need to create an html page for each current page (a lot of pages) and I will have to rewrite everything that is currently being done on the server in JavaScript including validation, database calls, populating controls such as dropdown lists and data grids, etc. Also everything that I change in the future will require a subsequent offline change.

Is there an established best practice for what I am trying to do that I am overlooking or am I venturing into new ground?

Handicap answered 10/10, 2012 at 14:19 Comment(3)
I am no expert here but it sounds like you need to have different users log into your site, all from the same browser session and all disconnected? That seems like a difficult scenario that would require you cache usernames and passwords on your client. Likely a dangerous practice.Howzell
Thank you for your reply. If I'm understanding you correctly, I think you are misunderstanding my strategy. The plan is to allow anyone that has previously logged in in online mode to later operate in offline mode. The normal case for the app that I am developing is that it would be accessed by a foreman on a mobile device (iphone, droid, tablet, etc.) so typically the same person would be using the same device. Are you saying that storing passwords via Web SQL or IndexDB is dangerous practice? If so, why?Handicap
Certainly storing username and password at the client may not be good practice at the same time, what james seems to have seems to be genuine problem to be resolved. Ideally when the end users would like to have access to the offline system, he also needs to be authenticated online and continue his work offline and synchronize online. I would think to use something like silverlight, but there seem to be a problem in terms of clients accessing silverlight, so Isolated storage is the only option left with.Chemush
C
3

Please refer to these links, which gives you some insight on what is to be achieved. I'm not sure these are best practices, but these will be good starting point.

http://www.c-sharpcorner.com/UploadFile/aravindbenator/offline-mvc3-application/ http://www.developerfusion.com/article/84438/isolated-storage/

Chemush answered 15/10, 2012 at 9:25 Comment(1)
Thank you Siva for this answer. I look forward to looking into isolated storage further as it appears that it will be a good tool. The model that you pointed out on c-sharpcorner seems like a good model for implementing the strategy that I outlined in my original question. Is it your opinion that caching an offline html file to correspond to each online aspx file is the best solution?Handicap

© 2022 - 2024 — McMap. All rights reserved.