473,516 Members | 3,399 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3130

"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
1509
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 expensive C++ books. Plus, I don't want to ask the instructor because that will give my project away. How do you call an external non C++ program, or...
8
4147
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 have an existing VC++ project that mostly just reads a SQL Server database does some work on the data and insert the results into another table. I...
47
3802
by: Richard Hayden | last post by:
Hi, I have the following code: /******************************** file1.c #include <iostream> extern void dummy(); inline int testfunc() {
1
1491
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: function a_message() { alert('I came from an external script! Ha, Ha, Ha!!!!'); } I am told to create an HTML page that accesses the .js script. (I...
2
12241
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 I am unable to link is the fact that upon calling windows.external , why a C++ UI is called and not something else. I want to understand that if...
9
11554
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; dll=Assembly.LoadFrom(@"c:\app\Assembly.dll");
6
26332
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 ___security_cookie Does anybody knows where does this symbol comes from? Is it because I am using a wrong library or have some bad compiler/linker...
1
1487
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: 00000064 call dword ptr ds: At another point in the same app, it calls the exact same entry point like this and it works: 00000051 call ...
4
3156
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 executes. Help! I can't figure this out. The external JS file is "members.js". Here's the code:
2
5301
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: 1>make_buildinfo.obj : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function _make_buildinfo2 Ask on...
0
7182
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7405
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7574
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5712
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5106
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3265
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
487
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.