I'm currently dealing with a workaround that functions properly on my local system but fails to work after I deploy it to our server.
The issue involves a webpage that launches an
EXE
file and then closes the webpage. Everything runs smoothly locally, but once it's published to the server, theEXE
doesn't run. I have double-checked that the file path is correct from the server.
This is the code for my Web Page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="EmailSignature_EXEC.aspx.cs" Inherits="_Default" %>
<html>
<head>
<title></title>
<script>
function loaded()
{
window.setTimeout(CloseMe, 500);
}
function CloseMe()
{
window.open('', '_self').close();
}
</script>
<script type="text/javascript">
</script>
</head>
<body onLoad="loaded()">
Hello!
\\\\cmbfs02\\Software\\web\\EmailSignature_WPF\\EmailSignature_WPF.exe
</body>
</html>
And here is the C# Code associated with it:
using System.Diagnostics;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load()
{
var applicationPath = "\\\\cmbfs02\\Software\\web\\EmailSignature_WPF\\EmailSignature_WPF.exe";
Process.Start(applicationPath);
this.ClientScript.RegisterClientScriptBlock(this.GetType(), "Close", "window.close()", true);
}
}
Upon accessing my page through IIS
, I observe the page opening and closing after the designated timeout, but the application fails to execute. Interestingly, if I manually paste the EXE
path into Windows Explorer, the application runs without any issues. However, it seems to be failing when triggered through the method in the code. Any suggestions or assistance would be highly appreciated.