How to Initiate .cmd file from asp.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hamayun Khan
    New Member
    • Aug 2007
    • 106

    How to Initiate .cmd file from asp.net

    Hi
    I have Install Web content extractor on my pc. Web Content Extractor exe has the following path
    C:\Program Files\Web Content Extractor\WCExt ractor.exe

    Now I used cmd file to initiate Web Content Extractor.

    I created cmd file and write the following text to file

    "C:\Program Files\Web Content Extractor\WCExt ractor.exe" "D:\ASP.NET\tea chnetwork\manag er\Scrapfiles\a bc-teachers.wcepr" -dr -rt -s -ddr -qe -ex"

    and save the file as abc-teachers.cmd on drive C

    When I double click on cmd file It initiate my web content extractor. Also On my pc(win xp) the following code run abc-teachers.cmd which initiate Web content extractor. but on windows Vista This code does not work. While double clicking the cmd file on windows Vista also works.



    Code:
    <%
    Dim myProcess As System.Diagnostics.Process
                Dim myInfo As New System.Diagnostics.ProcessStartInfo
                myInfo.FileName = "C:\\abc-teachers.cmd"
                myInfo.RedirectStandardOutput = True
                myInfo.UseShellExecute = False
                myProcess = System.Diagnostics.Process.Start(myInfo)
                'myProcess.Start()
                myProcess.Close()
    %>
    Any Help in this issue
    Thanks in advance
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    You realize that this code is going to execute on the server, right?

    If this has been working for you on the client, it is because you are serving the page from the same machine that you are viewing it from. If you put this on your webserver, and ran it from a different computer, this code is going to execute on the server, not the client.

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      I don't know what your WCExtractor does exactly.......

      But it requires sufficient permissions to run. Most of the time any applications run through an ASP.NET application are run under an account with minimal permissions and low trust.

      If your asp.net application requires this program for processing, I recommend looking into using impersonation to run the application using an account that has sufficient permissions to execute it.

      The same problem will exist in vista.

      It would probably be best to implement your asp.net application in such a way so that it does not depend on this console application.

      -Frinny

      Comment

      • Hamayun Khan
        New Member
        • Aug 2007
        • 106

        #4
        Originally posted by Frinavale
        I don't know what your WCExtractor does exactly.......

        But it requires sufficient permissions to run. Most of the time any applications run through an ASP.NET application are run under an account with minimal permissions and low trust.

        If your asp.net application requires this program for processing, I recommend looking into using impersonation to run the application using an account that has sufficient permissions to execute it.

        The same problem will exist in vista.

        It would probably be best to implement your asp.net application in such a way so that it does not depend on this console application.

        -Frinny
        Thanks for reply

        I m not asp.net expert. I don't know whether it is possible to run WCExtractor.exe
        with the following parameters.

        "D:\ASP.NET\tea chnetwork\manag er\Scrapfiles\c lick4teachers.w cepr" -dr -rt -s -ddr -qe -ex with out using console.

        Also I try impersonation but it did not work for me. I add the following line to config file

        <identity impersonate="tr ue" userName="xxx" password="xxxx"/>
        Can you help me please.

        Comment

        • Hamayun Khan
          New Member
          • Aug 2007
          • 106

          #5
          I also used the following

          [
          Code:
          <%
          Dim info As System.Diagnostics.ProcessStartInfo = New System.Diagnostics.ProcessStartInfo("C:\\Program Files\\Web Content Extractor\\WCExtractor.exe", """C:\\Documents and Settings\\hama\\Desktop\\Teachnetworkscrapjobs\\Scrapfiles\\abc-teachers.wcepr"" -dr -rt -s -ddr -qe -ex")
          Dim p = System.Diagnostics.Process.Start(info)
          p.Start()
          %>
          ]

          This code work on my pc successfully. On windows vista this does not initiate the exe. When i look into task manager processes. I find WCExtractor.exe running as Network services. (Network services below the user tab of task manager) While I did not see the WCE window on my desktop.
          Please help Its urgent.

          Comment

          Working...