How to call windows exe with parameter from asp.net.
-
I have a problem in asp.net i wanted to call my windows app exe from web app with paramters. its working with process.start(). but i can t see UI of windows app on clients machine. so i wrote javascripr function and its working fine , i can use windows UI on clients side. but now i dont know how to send arguments with that and how to fetch arguments in windows app. Please let me know asap. here is code. < SCRIPT Language="JScript"> function runcmd() { File="C:\\TestParamFromAsp.exe"; WSH=new ActiveXObject("WScript.Shell"); WSH.run(File); //document.getElementById('<%=btnSendMail.ClientID%>').click(); //sInfo=new System.Diagnostics.ProcessStartInfo("C:\\TestParamFromAsp.exe"); //p=new System.Diagnostics.Process; //sInfo.Arguments="12345"; //p.StartInfo=sInfo; //p.Start(); } </ SCRIPT> Codebehind is working independently. Protected Sub btnSendMail_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSendMail.Click 'Dim sInfo As New Diagnostics.ProcessStartInfo("C:\\CGS_NEWDESIGN_UPDATED\\ContractAutomation\\bin\\ContractAutomation.exe") '("C:\\TestParamFromAsp.exe") Dim sInfo As New Diagnostics.ProcessStartInfo("C:\\Documents and Settings\\hkacholi\\My Documents\\Visual Studio 2005\\Projects\\TestParamFromAsp\\TestParamFromAsp\\bin\\Debug\\TestParamFromAsp.exe") 'Dim sInfo As New Diagnostics.ProcessStartInfo("//vsapps/cgs/ContractAutomation.exe") 'C:\\Documents and Settings\\hkacholi\\My Documents\\Visual Studio 2005\\Projects\\TestParamFromAsp\\TestParamFromAsp\\bin\\Debug\\TestParamFromAsp.exe") 'Dim sInfo As New Diagnostics.ProcessStartInfo("C:\\TestParamFromAsp.exe") ' startInfo.WindowStyle = Diagnostics.ProcessWindowStyle.Maximized Dim p As New Diagnostics.Process 'Diagnostics.Process.Start(sInfo) sInfo.Arguments = "12345" 'Diagnostics.Process.Start(sInfo) sInfo.RedirectStandardOutput = True sInfo.RedirectStandardInput = True sInfo.RedirectStandardError = True sInfo.CreateNoWindow = True sInfo.UseShellExecute = False p.StartInfo = sInfo p.Start() End Sub hemaxi
-
I have a problem in asp.net i wanted to call my windows app exe from web app with paramters. its working with process.start(). but i can t see UI of windows app on clients machine. so i wrote javascripr function and its working fine , i can use windows UI on clients side. but now i dont know how to send arguments with that and how to fetch arguments in windows app. Please let me know asap. here is code. < SCRIPT Language="JScript"> function runcmd() { File="C:\\TestParamFromAsp.exe"; WSH=new ActiveXObject("WScript.Shell"); WSH.run(File); //document.getElementById('<%=btnSendMail.ClientID%>').click(); //sInfo=new System.Diagnostics.ProcessStartInfo("C:\\TestParamFromAsp.exe"); //p=new System.Diagnostics.Process; //sInfo.Arguments="12345"; //p.StartInfo=sInfo; //p.Start(); } </ SCRIPT> Codebehind is working independently. Protected Sub btnSendMail_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSendMail.Click 'Dim sInfo As New Diagnostics.ProcessStartInfo("C:\\CGS_NEWDESIGN_UPDATED\\ContractAutomation\\bin\\ContractAutomation.exe") '("C:\\TestParamFromAsp.exe") Dim sInfo As New Diagnostics.ProcessStartInfo("C:\\Documents and Settings\\hkacholi\\My Documents\\Visual Studio 2005\\Projects\\TestParamFromAsp\\TestParamFromAsp\\bin\\Debug\\TestParamFromAsp.exe") 'Dim sInfo As New Diagnostics.ProcessStartInfo("//vsapps/cgs/ContractAutomation.exe") 'C:\\Documents and Settings\\hkacholi\\My Documents\\Visual Studio 2005\\Projects\\TestParamFromAsp\\TestParamFromAsp\\bin\\Debug\\TestParamFromAsp.exe") 'Dim sInfo As New Diagnostics.ProcessStartInfo("C:\\TestParamFromAsp.exe") ' startInfo.WindowStyle = Diagnostics.ProcessWindowStyle.Maximized Dim p As New Diagnostics.Process 'Diagnostics.Process.Start(sInfo) sInfo.Arguments = "12345" 'Diagnostics.Process.Start(sInfo) sInfo.RedirectStandardOutput = True sInfo.RedirectStandardInput = True sInfo.RedirectStandardError = True sInfo.CreateNoWindow = True sInfo.UseShellExecute = False p.StartInfo = sInfo p.Start() End Sub hemaxi
You cant invoke client exe from your web site. Sorry :omg: Web sites dont have access to C:\ which you are using. If you call this using Diagonistic.Process.Start, it will run in the server, not in the client.
Abhishek Sur My Latest Articles Basics on LINQ and Lambda Expressions
Create .NET Templates -
You cant invoke client exe from your web site. Sorry :omg: Web sites dont have access to C:\ which you are using. If you call this using Diagonistic.Process.Start, it will run in the server, not in the client.
Abhishek Sur My Latest Articles Basics on LINQ and Lambda Expressions
Create .NET Templates -
my exe is not on c:\. its on server. besides that its not the question of running. its running from the server but my question is how to pass parameter ?
Then create an object of System.Diagonistic.Process (say p) and p.StartInfo= new ProcessStartInfo("filename","args") Now call start method.
Abhishek Sur My Latest Articles Basics on LINQ and Lambda Expressions
Create .NET Templates