locked
call exe on client machine RRS feed

  • Question

  • User-812756046 posted

    hello friends

     

      can anybody help me how to call any windows exe on asp.net when i have mentioned the code

     

       system.diagnositics.process.start("filename.exe") it is definetly open during compile time but when create the virtual directory and run on the localhost or client machine then it will not open on that case i have manage the iis where on authentication method check the windows integrated authentication. but no any effect so plz help me its too urgent

     

        thanks in advance

     

    Thursday, June 21, 2007 1:29 AM

Answers

  • User-2017008401 posted

    Hi agaurav,

    If you didn’t use impersonation, the default ASP.NET running account is “ASPNET” (for IIS 5) or “Network Service” (for IIS 6). You should give the ASP.NET running account read & execute permission for the folder which contains the exe file.

    For example: if the exe file is store in d:\temp\test.exe.

        1. In Window Explorer, right click “temp” folder and select “Properties”
        2. In Security tab, add “ASPNET” or “Network Service” in and give the “Read & Execute” permission.

    If you use impersonation, please check which account you are impersonating. To do so, please refer to the following link:

    ASP.NET Identity Matrix
    http://msdn.microsoft.com/en-us/library/aa302377.aspx

    Please bear in mind that process.start will start the server side exe file, not client side. To execute the exe file from the client side, we should use javascript. I have provided the following code for your reference. I hope it is helpful to you.

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head2" runat="server">
        <title>Run Executable HTA</title>

        <script language="javascript" type="text/javascript">
        function RunEXE()
        {
            var oShell = new ActiveXObject("WScript.Shell");
            var prog = "c:\\WINDOWS\\system32\\notepad.exe";
            oShell.Run('"'+prog+'"',1);
        }
        </script>

    </head>
    <body>
        <input id="Button1" onclick="RunEXE()" type="button" value="Notepad" />
    </body>
    </html>

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 25, 2007 7:47 AM

All replies

  • User-837620913 posted

    Did you also turn on impersonation?  Or did you give the ASP.NET account permission to access the exe?  It sounds like a security issue.

    Thursday, June 21, 2007 7:50 AM
  • User-812756046 posted

    thanx for yr sugession but i hav not idea about how to give the permission to asp.net account permission so plz help me

     

     

    Friday, June 22, 2007 12:43 AM
  • User-2017008401 posted

    Hi agaurav,

    If you didn’t use impersonation, the default ASP.NET running account is “ASPNET” (for IIS 5) or “Network Service” (for IIS 6). You should give the ASP.NET running account read & execute permission for the folder which contains the exe file.

    For example: if the exe file is store in d:\temp\test.exe.

        1. In Window Explorer, right click “temp” folder and select “Properties”
        2. In Security tab, add “ASPNET” or “Network Service” in and give the “Read & Execute” permission.

    If you use impersonation, please check which account you are impersonating. To do so, please refer to the following link:

    ASP.NET Identity Matrix
    http://msdn.microsoft.com/en-us/library/aa302377.aspx

    Please bear in mind that process.start will start the server side exe file, not client side. To execute the exe file from the client side, we should use javascript. I have provided the following code for your reference. I hope it is helpful to you.

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head2" runat="server">
        <title>Run Executable HTA</title>

        <script language="javascript" type="text/javascript">
        function RunEXE()
        {
            var oShell = new ActiveXObject("WScript.Shell");
            var prog = "c:\\WINDOWS\\system32\\notepad.exe";
            oShell.Run('"'+prog+'"',1);
        }
        </script>

    </head>
    <body>
        <input id="Button1" onclick="RunEXE()" type="button" value="Notepad" />
    </body>
    </html>

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 25, 2007 7:47 AM
  • User-812756046 posted

    Thanx 4 ur suggestion...But this throws the same error as earlier...."automation server cannot create any object"...

    How would I going to solve this problem....

    Tuesday, June 26, 2007 6:16 AM
  • User-812756046 posted

     hello friends

     

       i am asp.net developer. so my problem is here i want to retrive keywords for particular website when i have given domain name so if any body have any solution regarding this then kindly reply as soon as .

     

     

    thanks in advance
     

    Tuesday, July 15, 2008 9:10 AM
  • User1763172376 posted

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head2" runat="server">
        <title>Run Executable HTA</title>

        <script language="javascript" type="text/javascript">
        function RunEXE()
        {
            var oShell = new ActiveXObject("WScript.Shell");
            var prog = "c:\\WINDOWS\\system32\\notepad.exe";
            oShell.Run('"'+prog+'"',1);
        }
        </script>

    </head>
    <body>
        <input id="Button1" onclick="RunEXE()" type="button" value="Notepad" />
    </body>
    </html>


    not working, ActiveX is not defined error .
    Tuesday, February 23, 2010 9:40 PM
  • User1434148882 posted

    I was also try in this similar thing

    Sample Code

                ProcessStartInfo myProcess = new ProcessStartInfo("notepad.exe");
                myProcess.UserName = ConfigurationManager.AppSettings["username"];
                myProcess.Password = convertToSecureString(ConfigurationManager.AppSettings["password"]);
                myProcess.Domain = ConfigurationManager.AppSettings["domain"];
                myProcess.UseShellExecute = false;
                Process.Start(myProcess);

                ProcessStartInfo myProcess = new ProcessStartInfo("notepad.exe");

    ///Start the process with some power user rather than Network Service or ASPNET. I also tried impersonation  but no luck

                myProcess.UserName = ConfigurationManager.AppSettings["username"];

                myProcess.Password = convertToSecureString(ConfigurationManager.AppSettings["password"]);

                myProcess.Domain = ConfigurationManager.AppSettings["domain"];

                myProcess.UseShellExecute = false;

                Process.Start(myProcess);


    I gave permission on the folder, Enabled interact with Desktop on IIS Admin and Web Publishing Service.


    Surprising enough, code runs fine on XP machine. On Server 2003 and Server 2007 the process just loads in the memory but do nothing. 

    Any pointers ??? 

    Thursday, April 1, 2010 11:16 AM
  • User1763172376 posted

    i think there may be some prblem regarding IE security setup.

    Thursday, April 1, 2010 2:21 PM
  • User836291995 posted

    i have same problem ..

    so pleas help me how where i can set permisssion to run exe at server side by client

    Saturday, May 15, 2010 7:11 AM
  • User-837821593 posted

    hi, i  was having issue with this for about 3 days and I have now just solved this problem. It was to do with the security issues. 

    SOLUTION:

    1. just as All-star suggested above, you need to allow the ASPNET account to read/write, list directories and execute. (JUST THOSE 3 options, NOT full control). Also make sure you have inheritance on when(not needed but makes it easier). Reference to these steps, posted above by All-Star:

    If you didn’t use impersonation, the default ASP.NET running account is “ASPNET” (for IIS 5) or “Network Service” (for IIS 6). You should give the ASP.NET running account read & execute permission for the folder which contains the exe file.

    For example: if the exe file is store in d:\temp\test.exe.

        1. In Window Explorer, right click “temp” folder and select “Properties”
        2. In Security tab, add “ASPNET” or “Network Service” in and give the “Read & Execute” permission.

    2. You need to open the IIS properties, click on the 'Home Directory' tab and change the 'scripts only' to allow 'scripts and execution'. click apply and then a dialog will pop up asking you to change the child node of other virtual directories. You do not need to change them (unless you are making reference to and executables or batch files in these folders), so just click ok at this point.

    3. After you have done this you may want to read into securing you site or webapp with other measure, but with the new framework and iis7(i used iis5.1withXP) it should be fine.

    GoodLuck! This is my first ever post, so I hope I've helped save someone days of debugging. 

    Monday, October 4, 2010 4:36 PM