Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to call windows exe with parameter from asp.net.

How to call windows exe with parameter from asp.net.

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netvisual-studiodesignlinux
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hemrk
    wrote on last edited by
    #1

    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

    A 1 Reply Last reply
    0
    • H hemrk

      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

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      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

      H 1 Reply Last reply
      0
      • A Abhishek Sur

        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

        H Offline
        H Offline
        hemrk
        wrote on last edited by
        #3

        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 ?

        A 1 Reply Last reply
        0
        • H hemrk

          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 ?

          A Offline
          A Offline
          Abhishek Sur
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups