Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Running a C# winforms application from a web server

Options
  • 07-08-2008 11:04am
    #1
    Registered Users Posts: 2,835 ✭✭✭


    I'm just wondering if the above is possible? I have a winforms C# application that i've done up in VS2005 that loads in and displays a certain type of file.

    Is there any way I can host this application on a server and call it from the web so that it will run on a client machine? The reason i ask is that I want to be able to use the winforms app, but i dont want to have to run the installer on the machine first. I want the user to be able to click a link on the website, which passes a parameter to the application on the server, and the app runs on the clients machine until it is closed.

    TIA,

    Sticky


Comments

  • Registered Users Posts: 981 ✭✭✭fasty


    Your web application could call the xp_cmdshell stored procedure which would in turn launch your winforms app, or indeed whatever you want, on the server.

    It's a bit of a security minefield though.


  • Registered Users Posts: 15,065 ✭✭✭✭Malice


    I'd say security settings on the server will prevent that. Can you create an ASP.NET Web application and run the relevant C# code in it?


  • Registered Users Posts: 2,835 ✭✭✭StickyMcGinty


    malice_ wrote: »
    I'd say security settings on the server will prevent that. Can you create an ASP.NET Web application and run the relevant C# code in it?

    yea i've looked into going that route, but its the GUI functionality that i really want to utilise
    fasty wrote:
    Your web application could call the xp_cmdshell stored procedure which would in turn launch your winforms app, or indeed whatever you want, on the server.

    It's a bit of a security minefield though.

    Yea i've had great fun dealing with CAS before :P

    thanks for the replies lads, i'll look into it and let you know how i get on.


  • Registered Users Posts: 2,494 ✭✭✭kayos


    There is no way you can run a winforms app on a PC without it existing on that PC. Getting it to work the way you want is a security risk and goes against all good coding practice, to me it would be like some one raising a dialog box in server code.

    If the file type is custom the best thing to do is just do up a web form that will display the file in the same way as your winforms app.

    If the file is a pdf/xls etc its easy to code it to get the file and stream it down to the client browser.


  • Closed Accounts Posts: 169 ✭✭Joseph Kuhr


    visual WebGui will let you access a winform app via the web:

    http://www.visualwebgui.com/

    I tired it a long time back when it was still in beta and found it had a lot of room for improvement (noteably certain functionality was disabled). It may have come on since then though, its worth a go.


  • Advertisement
  • Registered Users Posts: 2,494 ✭✭✭kayos


    visual WebGui will let you access a winform app via the web:

    http://www.visualwebgui.com/

    I tired it a long time back when it was still in beta and found it had a lot of room for improvement (noteably certain functionality was disabled). It may have come on since then though, its worth a go.

    That just looks like a RAD AJAX toolkit for ASP.NET. It says the look of desktop on the web......


  • Registered Users Posts: 15,065 ✭✭✭✭Malice


    its the GUI functionality that i really want to utilise
    What part of the GUI? Listboxes, buttons, textboxes, check boxes, radio buttons and probably loads more work pretty much the same.
    I have a winforms C# application that i've done up in VS2005 that loads in and displays a certain type of file.
    From that quote there, I would say that the "loads in" part is the meat of the program and if you can get that transferred to a Web application then you can tailor the display accordingly.

    From the Visual Web GUI site:
    Visual WebGui replaces all of the ASP.NET methodologies with desktop-like WinForms developing methodologies.
    Reading waffle like "desktop-like WinForms developing methodologies" immediately turns me off :).


  • Closed Accounts Posts: 169 ✭✭Joseph Kuhr


    kayos wrote: »
    That just looks like a RAD AJAX toolkit for ASP.NET. It says the look of desktop on the web......

    unless its changed....used to be you develop as a WinApp, publish as a web app. Granted I haven't looked at it in a long while maybe they scraped that idea.


  • Registered Users Posts: 1,045 ✭✭✭Bluefrog


    I think this is as close as you're going to get and it's not pretty - http://www.csharp-station.com/Tutorials/SmartConsoleSetup.aspx - you might be able to automate and adjust this method to suit your needs but I think just having the users run a setup program would be easier.

    As a previous poster pointed out not good security practice - to encourage users to think doing this stuff is ok is asking for trouble.

    I have found over the years that when you have a task that looks too hard to do you are most likely trying to do it the wrong way ;)


  • Registered Users Posts: 515 ✭✭✭NeverSayDie


    As explained by folks above, you can't really do this directly without big security and config issues.

    Assuming your GUI is so complex that porting it to an ASP.NET UI isn't going to be feasible, you might be able to use ClickOnce to at least make the install and run process easier. Never used it myself, but from what I gather it's a relatively new deployment system from Microsoft that lets a user install/update apps over the web (or elsewhere) with minimal hassle and impact on their machine. That's the idea anyway, no idea how well it works in practice. See here;
    http://msdn.microsoft.com/en-us/library/142dbbz4(VS.80).aspx


  • Advertisement
  • Registered Users Posts: 413 ✭✭ianhobo


    Basically, the reason you (easily) can't is because windows apps are integrated to windows through the use of the winapi. Win32 apps and general winforms stuff make operating system specific calls to the windows kernel for processing, scheduling, thread execution, window handles, general resources, lots of integrated windows stuff. This allows for quick execution of apps, efficient use of memory/resouces

    The web and its apps are meant to be generic, accessible by any operating system through a common interface (browser). In the web app case, it is the browser which makes all the relevant calls to the operating system for window creation, button handles, memory, resources.

    The windows specific api calls that your stand alone app uses need to ported to more generic models using the buttons and features of the web in order to be accessed through the browser etc

    In order to keep the look and feel of your standalone app, and to let the client do most of the work, an ActiveX component would probably be the best solution?

    Hope that helps explain it


  • Registered Users Posts: 2,835 ✭✭✭StickyMcGinty


    first of all, thanks to everyone who replied. some of the explainations really hit home! i'm coming from a Java background so some aspects of .NET just need to be clarified until i get used to it, so thanks lads
    ianhobo wrote: »
    In order to keep the look and feel of your standalone app, and to let the client do most of the work, an ActiveX component would probably be the best solution?

    yea i actually did up some test code late last night to se if i could go the ActiveX route and it seems to be the only way to do it. I just got word that its being developed soley for IE6 SP1+ so i dont have to worry about compatability with FireFox et al


  • Registered Users Posts: 2,781 ✭✭✭amen


    could you use citrix or some other rdp client?


  • Registered Users Posts: 1,045 ✭✭✭Bluefrog


    Ai, that's the second time in the space of two days that one of the technologies that I would regard as coming from 'Satan's toolbox' has actually found a practical and justifiable application (the other was the possible use of frames in a site I am involved with). What's the world coming to...


  • Registered Users Posts: 9,557 ✭✭✭DublinWriter


    amen wrote: »
    could you use citrix or some other rdp client?
    VNC is free.


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    You could look into ClickOnce deployment which is great for this sort of thing. You publish to a server, user goes to page and clicks install and you're done.

    Great for publishing updates etc etc.. We use it here for a windows app thats deployed across multiple networks/domains etc.

    http://msdn.microsoft.com/en-us/library/t71a733d(VS.80).aspx


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    There is a deployment method that doesnt install, its just downloads and runs. When the user closes the program the system doesnt store the download .. similar to the way a web cache works..

    Might suit the way you want to run..

    Take a look http://msdn.microsoft.com/en-us/library/71baz9ah(VS.80).aspx specifically starting the application from a Network Share or Web Server.

    ClickOnce would probably work for you here in this case, and reduce your need for deploying it as ActiveX as certain ActiveX controls wont work and you need to digitally sign it with a code signing cert. While you can self sign if you deploy to a mass audience there will be issues with certs that makes it easier to buy from a CA such as Thwate.

    Also ActiveX killbits have been part of Windows Update meaning you have to change some registry entries to get some working again as well as problems with the click to activate issue that some controls have.


  • Moderators, Society & Culture Moderators Posts: 9,689 Mod ✭✭✭✭stevenmu


    ^ I've never deployed anything like that but I am using an app at the moment which (I think) is and it works extremely well.


Advertisement