I have an app that I\'m trying to run on an intranet. On my machine it worked great (famous last words) but when I put it up to the server, it didn\'t work. As soon as I saw
Since the machine already needs to have this "hidden" program installed, why not just write a native application and install that and have the employee run that instead of your web application?
There are a couple of ways to do this. One doesn't violate security (much).
You can download a file with a particular file type. That file type can be associated to the client program, so after clicking "ok" to download the file, the client program would launch. The downloaded file may or may not contain some data like the id of some object.
The alternative would be to resort to ActiveX, which does have security implications.
If you put your site in the IE Trusted or Intranet zone, the following Javascript will work just fine. I use this one internally to link our PC support DB search to our remote screen control software:
<script type="text/javascript" language="javascript">
function runDameWare(strHostname, blControl) {
var objShell = new ActiveXObject("Wscript.Shell");
var strCommand = "C:\\Program Files\\Dameware\\dwrcc.exe -c: -h: -m:";
strCommand += strHostname;
if (blControl) {
strCommand += " -v:";
}
objShell.Exec(strCommand);
}
</script>
My understanding is that uploading the results of your work in the local program to the web server can be accomplished using the HttpWebRequest
class, as shown in this article:
http://forums.asp.net/p/1482778/3464854.aspx
Edit:
This is how I call the above function. Basically I'm just rendering a plain <a>
element with the onclick
attribute. There's probably a cleaner way to do it, but it works:
Markup:
<asp:TemplateField>
<ItemTemplate>
<%# RenderDameWareLinks(Eval("ResourceName"))%>
</ItemTemplate>
</asp:TemplateField>
Code:
Protected Function RenderDameWareLinks(ByVal strHostname As String) As String
Dim strFullLink As String = String.Empty
Dim strViewLink As String = String.Empty
strFullLink = "<a onclick=""runDameWare('" & strHostname & "', false);"">"
strFullLink &= "<img alt=""Connect using DameWare"" src=""Image/dameware1.gif"" style=""padding: 2px;"" />"
strFullLink &= "</a><br/>"
strViewLink = "<a onclick=""runDameWare('" & strHostname & "', true);"">"
strViewLink &= "<img alt=""Connect (View Only) using DameWare"" src=""Image/dameware2.gif"" style=""padding: 2px;"" />"
strViewLink &= "</a>"
Return strFullLink & strViewLink
End Function
One idea: You can register a Protocol handler to launch your app with the required parameters.