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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Launch an exe file from a website

Launch an exe file from a website

Scheduled Pinned Locked Moved C#
csharpcsssysadminsecurityhelp
7 Posts 4 Posters 2 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.
  • C Offline
    C Offline
    Caroline Bornsjo
    wrote on last edited by
    #1

    Hi, This is my first post, so please excuse my poor english or if I miss giving you important info. I need to start a windowless exe file from an internal website. I have been using System.Diagnostics.Process with credentiels and without. If I use it with credentiels I get a "The application failed to initialize properly (0xc0000142)." error and without I get different sort of errors from the application I am trying to start. The exe I want to start is written in C# (as is the website), and I have the sourcecode for the exe. The website and the exe file is running on the same machine (a 2003 server). The exe is also running every night by a scheduled task. I have been trying to start the scheduled task aswell, but hit a dead rock there aswell... Does anyone have a good formula for doing this? As this is on an internal website the security issues are less crusial (but still important). Best Regards Caroline

    C C S 3 Replies Last reply
    0
    • C Caroline Bornsjo

      Hi, This is my first post, so please excuse my poor english or if I miss giving you important info. I need to start a windowless exe file from an internal website. I have been using System.Diagnostics.Process with credentiels and without. If I use it with credentiels I get a "The application failed to initialize properly (0xc0000142)." error and without I get different sort of errors from the application I am trying to start. The exe I want to start is written in C# (as is the website), and I have the sourcecode for the exe. The website and the exe file is running on the same machine (a 2003 server). The exe is also running every night by a scheduled task. I have been trying to start the scheduled task aswell, but hit a dead rock there aswell... Does anyone have a good formula for doing this? As this is on an internal website the security issues are less crusial (but still important). Best Regards Caroline

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      Caroline Ledin wrote:

      As this is on an internal website the security issues are less crusial (but still important).

      Statistically, most computer crime is an inside job. Therefore, logically, more emphasis should be put on security for internal applications. But that rarely happens.

      Caroline Ledin wrote:

      I get different sort of errors from the application I am trying to start.

      What is the error? Also, remember that if you start the process from the web application you will be using the same credentials as the web application, usually the ASPNET account. Could it be that the application requires more rights to operate than the ASPNET account permits?

      Caroline Ledin wrote:

      The exe is also running every night by a scheduled task. I have been trying to start the scheduled task aswell, but hit a dead rock there aswell...

      Are there any error messages from that scenario?


      Upcoming events: * Glasgow: SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

      C 1 Reply Last reply
      0
      • C Colin Angus Mackay

        Caroline Ledin wrote:

        As this is on an internal website the security issues are less crusial (but still important).

        Statistically, most computer crime is an inside job. Therefore, logically, more emphasis should be put on security for internal applications. But that rarely happens.

        Caroline Ledin wrote:

        I get different sort of errors from the application I am trying to start.

        What is the error? Also, remember that if you start the process from the web application you will be using the same credentials as the web application, usually the ASPNET account. Could it be that the application requires more rights to operate than the ASPNET account permits?

        Caroline Ledin wrote:

        The exe is also running every night by a scheduled task. I have been trying to start the scheduled task aswell, but hit a dead rock there aswell...

        Are there any error messages from that scenario?


        Upcoming events: * Glasgow: SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

        C Offline
        C Offline
        Caroline Bornsjo
        wrote on last edited by
        #3

        The error's I get from the application is 1.System.Security.SecurityException: That assembly does not allow partially trusted callers When I got this error, I added the ASP-user to the security tab of the exe file. After that I got the next error message: 2.An unhandled exception ('System.IO.FileLoadException') occurred in BankService.exe And I was stuck again... When I run the Scheduler task option I did the following exeProcess.StartInfo.FileName = "schtask"; exeProcess.StartInfo.Arguments ="/run /tn BankService"; and exeProcess.StartInfo.FileName = "cmd"; exeProcess.StartInfo.Arguments ="schtask /run /tn BankService"; It didnt do anything... I checked the scheduler and nothing had happened and I checked the Task manager and no process with the bankservice had started. The exe im trying to start I have stripped from doing anything but Console.WriteLine and EventLog.WriteEntry. In the webconfig file it is added (not due to this) How do I set the asp net user to access the desktop or can I get the process to run as antoher user but the net user?. The website requires you to log in with your windows credentiels... /Caroline

        1 Reply Last reply
        0
        • C Caroline Bornsjo

          Hi, This is my first post, so please excuse my poor english or if I miss giving you important info. I need to start a windowless exe file from an internal website. I have been using System.Diagnostics.Process with credentiels and without. If I use it with credentiels I get a "The application failed to initialize properly (0xc0000142)." error and without I get different sort of errors from the application I am trying to start. The exe I want to start is written in C# (as is the website), and I have the sourcecode for the exe. The website and the exe file is running on the same machine (a 2003 server). The exe is also running every night by a scheduled task. I have been trying to start the scheduled task aswell, but hit a dead rock there aswell... Does anyone have a good formula for doing this? As this is on an internal website the security issues are less crusial (but still important). Best Regards Caroline

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Caroline Ledin wrote:

          windowless exe file

          Sounds like what you need to do is write it as a service, I'm pretty sure you can set up a service to be called from an ASP.NET app.

          Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

          1 Reply Last reply
          0
          • C Caroline Bornsjo

            Hi, This is my first post, so please excuse my poor english or if I miss giving you important info. I need to start a windowless exe file from an internal website. I have been using System.Diagnostics.Process with credentiels and without. If I use it with credentiels I get a "The application failed to initialize properly (0xc0000142)." error and without I get different sort of errors from the application I am trying to start. The exe I want to start is written in C# (as is the website), and I have the sourcecode for the exe. The website and the exe file is running on the same machine (a 2003 server). The exe is also running every night by a scheduled task. I have been trying to start the scheduled task aswell, but hit a dead rock there aswell... Does anyone have a good formula for doing this? As this is on an internal website the security issues are less crusial (but still important). Best Regards Caroline

            S Offline
            S Offline
            subrata jana
            wrote on last edited by
            #5

            if that is a .net exe then add it in GAC. with "gacutil -i exe_path" then give full trust to it with "caspol -af exe_path" use sdk command prompt. Add this in webconfig. try ur program after that.

            C 1 Reply Last reply
            0
            • S subrata jana

              if that is a .net exe then add it in GAC. with "gacutil -i exe_path" then give full trust to it with "caspol -af exe_path" use sdk command prompt. Add this in webconfig. try ur program after that.

              C Offline
              C Offline
              Caroline Bornsjo
              wrote on last edited by
              #6

              sorry for the late reply, but had to try/fix a few things to get it all working. I have installed the exe with the gacutil tool and had to strong name type it first... Then when I try the caspol command I get an error Usage: caspol ... any suggestions on this error? I hate to be forced to make a service out of this.... Thanks for the help by the way :) /Caroline

              C 1 Reply Last reply
              0
              • C Caroline Bornsjo

                sorry for the late reply, but had to try/fix a few things to get it all working. I have installed the exe with the gacutil tool and had to strong name type it first... Then when I try the caspol command I get an error Usage: caspol ... any suggestions on this error? I hate to be forced to make a service out of this.... Thanks for the help by the way :) /Caroline

                C Offline
                C Offline
                Caroline Bornsjo
                wrote on last edited by
                #7

                Made the service and is stuck on yet another access denied problem... When I try to start the service myControl = new ServiceController("StartSchTask"); String[] args; args = new String[2]; args[0] = "BankService"; args[1] = "cl@ikaros.se"; myControl.Start(args); I get the "Cannot start service StartSchTask on computer '.'." error and I believe that this is an access denied error.... any suggestions...*banging head into the wall...* /Caroline

                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