0

I am very new to asp.net. Infact all i know till date is through web :) I have build a website which is working fine. but now due to some reasons i have to convert it into a desktop application. I want both of them to be working. My questions: a) how can i convert it into desktop application? b) which server will i be using as i already have a website on goaddy server? c) do i have to install the desktop app on every window pc for it to work? any other alternative if so? d) i want my desktop application to work much similar to the website.. is there something like offline website?

any help will be appreciated. thank you in advance :)

Ashi
  • 3
  • 3

3 Answers3

0

Well you'll need to refactor some of your code so that you can share it between your asp.net web application and the winforms desktop application - you probably want a core project to share code between the two. Your desktop application can contact the same database as your web application but you might need to consider the number of connections and latency between the desktop client and the database on the web. You'll need to install it on the PCs for the app to work, if you are on a network your sysadmin can probably do it through group policy.

There are things like local storage etc for offline/intermittent connectivity with websites, I don't think that will help in your scenario.

LightningShield
  • 680
  • 3
  • 13
  • this is what i was thinking.. i think thts exactly what can be done right now.. thank you :) – Ashi Jul 29 '14 at 06:17
0

a) You will need to learn WinForms. Websites (or in your case I believe it will be a web application) are built very differently to WinForm applications.

b) Your web application will stay with GoDaddy and c) you will need to install it on every desktop that will use the WinForms version of your web applications.

b) + c) but if you build your WinForms app properly, you maybe able to use the database with GoDaddy as the data source.

d) web apps can be sort of offline. In an office environment you may have a central server that can be used as a web server. You would install your web app on there and by knowing the name of the central server you would be able to access it e.g.

http://myinternalserver:8080/mywebapp/

or via the IP address

http://192.168.5.255/mywebapp/

That way if you external internet connection goes down, the web application will still work (unless you have external dependencies). If you go this route there are many different ways you can get it to work.

In my own personal opinion you are best to use 1 server in your office environment to host the web app so that all desktop machines in your office can access. It will be also cheaper than having a hosting account elsewhere. This leads to more control by you, faster updates, no worries about hardware issues. You can hook into the all the server's security and log on features. Basically it's much cooler and fun to learn than WinForms :D

Hope this helps.

Colin Wiseman
  • 848
  • 6
  • 10
0

I solved that problem like this:

Create a small winforms application that runs (or minimizes) in the tray.
Get the assembly Mono.WebServer from the mono-project.
Add it as a reference to your web-application, set localcopy to true.

Put your web-appliaction into folder c:\whatever\YourWebApplication
Reference the same version of mono.webserver in your winforms application.
Have the application start at a port > 10000 (so it doesn't require admin rights)
Open a browser of your choice at http:// localhost :yourport (you can xcopy google-chrome and use it without admin rights) with system.diagnostics.process.start

And use the web application as desktop application.
If you use Firebird, you can use Firebird on the web, and Firebird embedded on the desktop.
If you use MySQL, you can use MariaDb (just copy the zip-deploy into a folder of your choice, and start the database before you start your application).
If you use PostgreSQL, you can use Postgresql Portable, and xcopy deploy before you start your application.


if you use SQL-Server, you're screwed, because SQL-Server express will require installation...

public static void Main (string[] args)
{
    int Port=18080;

    string path=@"c:\wherever\YourWebApplication";

    XSPWebSource websource=new XSPWebSource(IPAddress.Any,Port);

    ApplicationServer WebAppServer=new ApplicationServer(websource);

    //"[[hostname:]port:]VPath:realpath"

    string cmdLine=Port+":/:"+path;

    WebAppServer.AddApplicationsFromCommandLine(cmdLine);

    WebAppServer.Start(true);

    Console.WriteLine("Mono.WebServer running. Press enter to exit...");

    System.Diagnostics.Process.Start("iexplore http:// localhost /:" + Port.ToString());

    Console.ReadLine();

    WebAppServer.Stop();
}

If you want the data to be on a central server, you need to use web-services (JSON/JSONP) and http-post to update and retrieve data. However, this is not very offline-ish.

In any way, avoid having to maintain 2 separate applications at all costs.

You can also synchronize dbs between the offline and the online version. You'll need a web-service that syncs the data (and schema) between the two.
If you operate with GUIDs (uuids in PostgreSQL) in your tables, you can sync new entries in your offline database relatively easy to your online database.

The problem starts when you delete or alter entries.
You'll need to handle "what happens if somebody else altered after you synced and went offline, and you altered the same field in the same row, but to a different value ? )
And how do you detect deletes ?
A new row might have been added after you went offline, so you can't just delete any row that's not in your offline-db anymore...

An easy solution would be:
Block alterations & deletes in offline-mode

Stefan Steiger
  • 78,642
  • 66
  • 377
  • 442
  • hello.. thank you for your reply. I am very new to asp.net. I dnt really want to use new concepts at this stage bt will surely give it a try :) – Ashi Jul 29 '14 at 06:15