473,231 Members | 1,955 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

External exe call from asp.met

Hi Group,

I want to execute a vbs file from an aspx page.
With no success.

For instance, simple script that create a text file with 1 line in it.
Works fine from commandline or dblclicking on it.

But no luck with asp.net.

I have used :
System.Diagnostics.Process
and
Microsoft.VisualBasic.Interaction.Shell

Nothing is working.
No error, no nothing.
It is driving me crazy and I wonder if it could be a security issue.

I have used <identity impersonate with an admin user. Nothing.
All examples I have found on the net are not working.

Can someone help me on this?

Thank you.

Gerald
Dec 9 '05 #1
6 3123

"Gerald" <ge*****@hotmail.com> wrote in message
news:Ob*************@TK2MSFTNGP11.phx.gbl...
Hi Group,

I want to execute a vbs file from an aspx page.
With no success.

For instance, simple script that create a text file with 1 line in it.
Works fine from commandline or dblclicking on it.

But no luck with asp.net.

I have used :
System.Diagnostics.Process
and
Microsoft.VisualBasic.Interaction.Shell

Nothing is working.
No error, no nothing.
It is driving me crazy and I wonder if it could be a security issue.

I have used <identity impersonate with an admin user. Nothing.
All examples I have found on the net are not working.

Can someone help me on this?

Thank you.

Gerald


First, why do you wan't to call a vbs script from aspx? Why not simply do in
your aspx code what you are doing in vbs?
Second, how did you determine nothing is working? What exactly are you doing
in your vbs script, you don't expect to see something on the server console
do you?

Willy.

Dec 9 '05 #2
I have a set of vbs script that work for a long time.
At the moment, the only thing I do in my test is creating a file on the
server.
So nothing complicated. I just want to be able to run the script.
After that I will see if I can go further.

Alos, when I call wscript. I can see the process on process viewer, with the
right parameters, but it is not fired
Why?

Thank you.

Gerald
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...

"Gerald" <ge*****@hotmail.com> wrote in message
news:Ob*************@TK2MSFTNGP11.phx.gbl...
Hi Group,

I want to execute a vbs file from an aspx page.
With no success.

For instance, simple script that create a text file with 1 line in it.
Works fine from commandline or dblclicking on it.

But no luck with asp.net.

I have used :
System.Diagnostics.Process
and
Microsoft.VisualBasic.Interaction.Shell

Nothing is working.
No error, no nothing.
It is driving me crazy and I wonder if it could be a security issue.

I have used <identity impersonate with an admin user. Nothing.
All examples I have found on the net are not working.

Can someone help me on this?

Thank you.

Gerald


First, why do you wan't to call a vbs script from aspx? Why not simply do
in your aspx code what you are doing in vbs?
Second, how did you determine nothing is working? What exactly are you
doing in your vbs script, you don't expect to see something on the server
console do you?

Willy.

Dec 9 '05 #3

"Gerald" <ge*****@hotmail.com> wrote in message
news:uw*************@tk2msftngp13.phx.gbl...
I have a set of vbs script that work for a long time.
At the moment, the only thing I do in my test is creating a file on the
server.
So nothing complicated. I just want to be able to run the script.
After that I will see if I can go further.

Alos, when I call wscript. I can see the process on process viewer, with
the right parameters, but it is not fired
Why?

Thank you.

Gerald


If you see the process in process explorer it means it is running right?
What do you mean with " it's not fired"? Please explain more precisely what
you expect.

Willy
Dec 9 '05 #4
When I try to to fire wscript.exe, I can see it in the process viewer,

So my command line lookl like this:
C:\Windows\System32\wscript.exe D:\Mtpath\testfile.vbs Param1 param2 param3
....

Wscript never closes (But I can kill it if I want) but the vbs file is never
called.
As the file that should be created never appears.

So, my vbs file is this:
========================
Option Explicit
dim oFSO:Set oFSO = wscript.CreateObject("scripting.filesystemobject")
dim oFile:set oFile =
oFSO.CreateTextFile("E:\\wwweb\\supportsoft.aumedi age.be\\Download\\eee.txt",
true)
oFile.writeline("Company = Hardcoded from file")
oFile.close
============================

my code in aspx.cs page is:
============================
System.Diagnostics.Process process1;
process1= new System.Diagnostics.Process();
process1.EnableRaisingEvents = false;
string strCmdLine = " /NoLogo E:\\wwwroot\\CREation2.vbs";
process1.StartInfo.FileName = "C:\\WINDOWS\\system32\\wscript.exe";
process1.StartInfo.Arguments = strCmdLine;
process1.StartInfo.UseShellExecute = false;
process1.StartInfo.RedirectStandardOutput = true;
process1.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process1.StartInfo.CreateNoWindow = true;
process1.Start();
process1.WaitForExit(8000);
if (process1.HasExited) {
SC_E.Text += "exited<br>";
SC_E.Text += "exit code: " + process1.ExitCode.ToString();
}
else {
process1.Kill();
SC_E.Text += "NO exit";
}
process1.Close();
==========================================

Thanks for your help.
It will be really appreciated.

Gerald
Why doesnt he get
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...

"Gerald" <ge*****@hotmail.com> wrote in message
news:uw*************@tk2msftngp13.phx.gbl...
I have a set of vbs script that work for a long time.
At the moment, the only thing I do in my test is creating a file on the
server.
So nothing complicated. I just want to be able to run the script.
After that I will see if I can go further.

Alos, when I call wscript. I can see the process on process viewer, with
the right parameters, but it is not fired
Why?

Thank you.

Gerald


If you see the process in process explorer it means it is running right?
What do you mean with " it's not fired"? Please explain more precisely
what you expect.

Willy

Dec 9 '05 #5
There could be a security issue. Check for the exit code:
Process.ExitCode != 0
some error happened during execution.

Security can be handled in two ways:
Give ASPNET user execute rights (BAD IDEA) or use
impersonation(BETTER).

Also, try some thing simpler to execute first like: echo hello world

HTH.

Dec 9 '05 #6
Never ever use wscript as exe in a non GUI context like ASP and ASP.NET.
When an error occurs a modal dialog will get displayed to a non interactive
desktop, this dialog is endlessly waiting for a OK click event before it
returns, with as result that Wscript.exe doesn't terminate.
Change you code to ...
process1.StartInfo.FileName = "C:\\WINDOWS\\system32\\cscript.exe";
Or better throws away this script and use the framework IO classes, they are
made for this.

Willy.

"Gerald" <ge*****@hotmail.com> wrote in message
news:uM**************@TK2MSFTNGP11.phx.gbl...
When I try to to fire wscript.exe, I can see it in the process viewer,

So my command line lookl like this:
C:\Windows\System32\wscript.exe D:\Mtpath\testfile.vbs Param1 param2
param3 ...

Wscript never closes (But I can kill it if I want) but the vbs file is
never called.
As the file that should be created never appears.

So, my vbs file is this:
========================
Option Explicit
dim oFSO:Set oFSO = wscript.CreateObject("scripting.filesystemobject")
dim oFile:set oFile =
oFSO.CreateTextFile("E:\\wwweb\\supportsoft.aumedi age.be\\Download\\eee.txt",
true)
oFile.writeline("Company = Hardcoded from file")
oFile.close
============================

my code in aspx.cs page is:
============================
System.Diagnostics.Process process1;
process1= new System.Diagnostics.Process();
process1.EnableRaisingEvents = false;
string strCmdLine = " /NoLogo E:\\wwwroot\\CREation2.vbs";
process1.StartInfo.FileName = "C:\\WINDOWS\\system32\\wscript.exe";
process1.StartInfo.Arguments = strCmdLine;
process1.StartInfo.UseShellExecute = false;
process1.StartInfo.RedirectStandardOutput = true;
process1.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process1.StartInfo.CreateNoWindow = true;
process1.Start();
process1.WaitForExit(8000);
if (process1.HasExited) {
SC_E.Text += "exited<br>";
SC_E.Text += "exit code: " + process1.ExitCode.ToString();
}
else {
process1.Kill();
SC_E.Text += "NO exit";
}
process1.Close();
==========================================

Thanks for your help.
It will be really appreciated.

Gerald
Why doesnt he get
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...

"Gerald" <ge*****@hotmail.com> wrote in message
news:uw*************@tk2msftngp13.phx.gbl...
I have a set of vbs script that work for a long time.
At the moment, the only thing I do in my test is creating a file on the
server.
So nothing complicated. I just want to be able to run the script.
After that I will see if I can go further.

Alos, when I call wscript. I can see the process on process viewer, with
the right parameters, but it is not fired
Why?

Thank you.

Gerald


If you see the process in process explorer it means it is running right?
What do you mean with " it's not fired"? Please explain more precisely
what you expect.

Willy


Dec 9 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Hagar | last post by:
I am currently learning C++ and am into a project for the end of the semester finals. Everything is rosy except for one feature that I want to include and can't find in my very large and...
8
by: Scott Allen | last post by:
Hello, I'm new to C++ development and I'm trying out figure out the cause of an 'unresolved external symbol' error that I'm receiving when compiling. Here is some history on what I'm doing: I...
47
by: Richard Hayden | last post by:
Hi, I have the following code: /******************************** file1.c #include <iostream> extern void dummy(); inline int testfunc() {
1
by: Chuck Mendell | last post by:
I am having problem with external javascripts. My OS is XP Pro. I am told to create an external javascript using a .js extension. (I did that) The external .js is very simple, containing: ...
2
by: Sandeep | last post by:
Hi I have a VC++ ui which has an HTML Container. I have several Javascript functions that need to call functions in VC++ UI. For this , the existing code is using a call "windows.external". What...
9
by: keith | last post by:
I created a class libery which has name space Assembly and class Assembly and compiled it. Then created a C# project and called a method in the external class e.g. Assembly dll;...
6
by: Olivier Lechenne | last post by:
I am converting some projects from VS 6.0 to VS .NET 2003 and I get a linker error error LNK2001: unresolved external symbol ___security_cookie or error LNK2001: unresolved external symbol...
1
by: stevo | last post by:
What causes C# to generate code to call the same external DLL 2 different ways? At one point in the app, it calls the entry point like this (disassembled) and it bombs with a null reference:...
4
by: dennise9 | last post by:
My exeternal JS works fine when the call is placed in the page head or body. But if I call the same javascript from a (clicked) text link on the page, the script throws a JS error when it...
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.