views:

880

answers:

8

We have a web application that uses AJAX to talk to an ASP.NET web service. We would like to write another version that can be used offline. We need to be able to re-use our existing code as much as possible. What approaches should we consider?

A: 

You want to build a web application to work offline?? It can't be done.

You could split the interface code from the rest (in diferent dlls) and create a windows application to mimic the behaviour of your web application. This way you have 2 distinct user interfaces but the same code for business rules and data access.

I don't really see any other way...

Sergio
I've seen it done with DOJO.. though i'm not sure of the details enough to answer this question
Evildonald
+1  A: 

One of the possibilities would be to use Cassini. This is a web server that acts as a host for the ASP.Net runtime. You can host Cassini in a Windows application or a Windows Service. In this scenario you do not have to rewrite the web app and the web service.

Most other solutions do require a rewrite of both your web app and your web service. Depending on the way you have written the existing app you can reuse more or less code.

Rine
A: 

If you hope to create an "offline" version of your package your biggest issue by far will be the need to install your site into a local copy of IIS (registering a virtual directory, etc.). I pursued this briefly a few years ago and gave up in frustration. It can be done: a number of software vendors such as DevExpress do this so you have local copies of their demonstration projects. Indeed, I was able to do this. The problem was the classic "it works on my computer" syndrome. There was simply no way to guarantee that most of my end-users had anywhere near the technical proficiency to make this work.

Thus, I would strongly recommend that you not pursue this path unless you have very technically proficient users and a huge support staff.

But there is one more very important question: did you abstract all data access code to a DAL? If not, then you have a lot of work to do in managing data access as well.

Update: user "Rine" has recommended Cassini. I just wanted to let you know that I pursued Cassini and another 3rd-party web server as well. I think that there are licensing issues with Cassini but may be wrong - it has been awhile. However, I do distinctly remember running into barrier after barrier with this approach and very little documentation to help me out.

Mark Brittingham
VS uses a ASP.Net Dev Web Server to run web apps locally during development. I believe this web server is based on Cassini. See http://msdn.microsoft.com/en-us/library/58wxa9w5(VS.80).aspx for details about the local ASP.Net web service
Rine
Yes - thanks - I'm familiar with it.
Mark Brittingham
A: 

if you want a web application run offline, you need a webserver (IIS for ASP) bound to the localhost (127.0.0.1) address. After this so can access your web application by typing http://127.0.0.1/ in your web browser the same way as you do online.

Calmarius
A: 

If your AJAX relies on XMLHttpRequest's, you can:

  1. Make the static versions of XML's you get over XMLHttpRequest and put then into a folder on disk.
  2. Rewrite your XMLHttpRequest URL's so that they point to files on disk.
  3. Rewrite your XMLHttpRequest's so that they don't check status (it's always 0 for the file:// protocol.

All JScript works on file:// pages as well as on http:// ones.

Of course it's not the best way to develop static pages, but it may save you some time on rewriting.

Quassnoi
A: 

The app is currently using XmlHttpRequest to get dynamic data from the server. Obviously the offline version will not be able to talk to the server, but it does need to talk to something! I'm sure installing IIS or Cassini on the client would work, but I was hoping for a simpler solution. Is there no other way for JavaScript to talk to some external code?

matthewk
A: 

There are plenty offline web apps nowaday. It simply evolve from AJAX.

For example:

WoaS (wiki on a stick / stickwiki), Tiddly Wiki,

Google doc and Gmail is going to be offline.

You don't need a webserver to run these webapps in offline mode. Just store the required data, scripts on the client side (usually as XML).

A: 

I want to Run my web app in Offline mode. I want to implement Google Gears to make the application work offline. but is it possible to make it work with a custom browser like SWT? If not, What are the other possiblities of making it work?

Ask your own question please. Don't hijack others.
matthewk
-1 agreed. Start your own thread.
Evildonald