Announcement

Collapse
No announcement yet.

C# calling VBS

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • C# calling VBS

    Rephrased

    I'm having issues calling a vbscript. I'm not as familiar with C# as I would like to be, so I'm having issues calling an onclick function from an image button.

    Any ideas?
    Last edited by Spiritnblk; 12th August 2008, 21:15.

  • #2
    Re: C# calling VBS

    Originally posted by Spiritnblk View Post
    Rephrased

    I'm having issues calling a vbscript. I'm not as familiar with C# as I would like to be, so I'm having issues calling an onclick function from an image button.

    Any ideas?
    From the image button on click event:
    Code:
    private void button1_Click(object sender, EventArgs e)
            {
                System.Diagnostics.Process.Start("yourscript.vbs", mstrArguments);
            }
    Last edited by ahinson; 14th August 2008, 22:02.
    Andrew

    ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

    Comment


    • #3
      Re: C# calling VBS

      Originally posted by ahinson View Post
      From the image button on click event:
      Code:
      private void button1_Click(object sender, EventArgs e)
              {
                  System.Diagnostics.Process.Start("yourscript.vbs", mstrArguments);
              }

      For whatever reason it's not working (probably me). I read somewhere that
      Windows Script Host and ASP don't work well together. Do you know if that's true?

      BTW...Thanks for the reply

      Comment


      • #4
        Re: C# calling VBS

        Originally posted by Spiritnblk View Post
        For whatever reason it's not working (probably me). I read somewhere that
        Windows Script Host and ASP don't work well together. Do you know if that's true?

        BTW...Thanks for the reply
        They should work together for desktop applications, ASP.net is a different story. What's going on here is that you're starting an external application, which could be a batch file, a script or another program - it doesn't care. Things are different for ASP.net, which runs under the ASPNET/Network Service account(s), which don't allow interactive logon so there's no desktop if you're spawning applications, which I hope you're not doing since there's likely no one looking. Also, these accounts by default don't allow process execution - which is required to start an application/script.

        To get around this configure IIS to impersonate a different user account.
        Last edited by ahinson; 21st August 2008, 22:22.
        Andrew

        ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

        Comment

        Working...
        X