473,387 Members | 3,821 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,387 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 1298

"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

0
by: Kouts | last post by:
Hello all! I would like to ask something regarding dlls and Java: I would like to transform my Java code to a dll, in order to allow to third party applications (e.g. VB or Power Builder...
0
by: ChrA | last post by:
Hi. I am having some problems calling a Sybase EAServer 5 from my ASP.NET app: The .NET application invokes methods on EAServer. EAServer then executes some stored procedures, and connects to...
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() {
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...
0
by: Dave Sisk | last post by:
I've created a system or external trigger on an AS/400 file a.k.a DB2 table. (Note this is an external trigger defined with the ADDPFTRG CL command, not a SQL trigger defined with the CREATE...
3
by: Paul Drabik | last post by:
First time post here ... I have been researching and not found info on this. One user here described the succinct way to call MS-Access and kick off a command: ===== Dim app As...
0
by: Kevin Stedman | last post by:
I am porting some software from Solaris to Windows. I am using the Windows Visual Studio .NET 2003 Visual C++ compiler. For the fortran files I am using Compaq Visual Fortran 6. I have my...
0
by: wingman | last post by:
Hello All I'm completely new to ASP.Net. I need to write a page to fetch an external call which actually call a Java program to download a file, the content of this downloaded is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.