C# calling VBS

Home Forums Scripting General Scripting C# calling VBS

This topic contains 3 replies, has 2 voices, and was last updated by Avatar Spiritnblk 10 years, 10 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • Avatar
    Spiritnblk
    Member
    #134323

    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?

    Avatar
    ahinson
    Member
    #216464

    Re: C# calling VBS

    Spiritnblk;117257 wrote:
    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);
    }
    Avatar
    Spiritnblk
    Member
    #308780

    Re: C# calling VBS

    ahinson;117833 wrote:
    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

    Avatar
    ahinson
    Member
    #216466

    Re: C# calling VBS

    Spiritnblk;118256 wrote:
    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.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.