Click here to Skip to main content
15,941,894 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I have a strange requirement from a client that I have been battling with for weeks.

The client has a standalone exe and web applications sitting on Windows 2012 Server. The Plan is to incorporate the exe application into the Web applications so that it can be rendered through the browser or called via a hyperlink. The exe application is portable. Web applications run on .NET framework 3.5,written in C#.

Due to high security restrictions on the server none of my attempts seem to work. When I click on the button on the page nothing happens.

I am now exploring delivering the exe application to end users via WebDAV. Any ideas would be helpful.

What I have tried:

On web.config I sent the path.
<appSettings>
		<add key="EXELOC" value="C:\Temp\addons\"/>

	</appSettings>


On the aspx page I have a button that calls the application
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Diagnostics;
using System.Configuration;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnStart_Click(object sender, EventArgs e)
    {
        string locn = ConfigurationManager.AppSettings["EXELOC"];
        Process myProcess = new Process();

        try
        {
            myProcess.StartInfo.UseShellExecute = True;
            myProcess.StartInfo.FileName = locn + "Application.exe";
            myProcess.StartInfo.CreateNoWindow = true;
            myProcess.Start();           
         
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }

    }


I have also attempted to utilize URI:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Ach]
@="URL:Ach Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\Ach\DefaultIcon]
@="C:\Temp\addons\\Application.exe"

[HKEY_CLASSES_ROOT\Ach\shell]

[HKEY_CLASSES_ROOT\Ach\shell\open]

[HKEY_CLASSES_ROOT\Ach\shell\open\command]
@="\"C:\\Temp\\addons\\Application.exe\" /u \"%1\""


I have also attempted setting the application UNC and calling via Javascript:

<script type="text/javascript" language="javascript">
        function RunFile() {
		WshShell = new ActiveXObject("WScript.Shell");
		WshShell.Run("\\\\192.168.5.8\\Applications\\Application.bat", 1,false);
        }
    </script>
Posted
Updated 30-Dec-19 8:22am
v2
Comments
Richard MacCutchan 30-Dec-19 4:23am    
But in all cases this application will run in the server.
ZurdoDev 30-Dec-19 8:22am    
As he said. ^ Which means you have to download it to the client, if you want it to execute on the client.
Noel Simela 2-Jan-20 10:22am    
I guess that would be the alternative.

1 solution

This is FAR more complicated than your giving it credit for.

First, you cannot launch an .EXE from your javascript code, period. It's a MASSIVE security risk to allow such, therefore, browsers don't allow it.

Also, you can't even create an ActiveXObject in javascript anymore either, for the same reasons.

In order for the executable to run, where you DON'T have to send the .EXE to the client (you can't launch it anyway), you would need a server infrastructure, like Citrix or VMware Horizon, where the app is launched on the server and you can see the app UI rendered on the client. This also requires installing the client software for the server hosting on each machine that's going to run this app. Look into "Application Virtualization" or "Desktop Virtualization".
 
Share this answer
 
Comments
Noel Simela 2-Jan-20 10:21am    
Hi Dave, I am familiar with RDS and Citrix solution. This is a unique situation where the client wanted to avoid licensing costs associated with such App Virtualization solutions.
Dave Kreskowiak 2-Jan-20 17:57pm    
Yeah, well, they're not going to escape it if they want to run the app from a web page.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900