Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Willy Denoyette [MVP]
"Gerald" wrote in message news:ObxoT7N$
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.
"Gerald" <gege107@hotmail.com> wrote in message
news:ObxoT7N$FHA.344@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?
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.
Gerald
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]" wrote in message news:%23KL%23sAO$
"Gerald" wrote in message news:ObxoT7N$
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.
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]" <willy.denoyette@telenet.be> wrote in message
news:%23KL%23sAO$FHA.3872@TK2MSFTNGP12.phx.gbl...
"Gerald" <gege107@hotmail.com> wrote in message
news:ObxoT7N$FHA.344@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?
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]" wrote in message news:%23KL%23sAO$
"Gerald" wrote in message news:ObxoT7N$
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.
Willy Denoyette [MVP]
"Gerald" wrote in message news:uwvGZEO$
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
"Gerald" <gege107@hotmail.com> wrote in message
news:uwvGZEO$FHA.208@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.
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
Gerald
When I try to to fire wscript.exe, I can see it in the process viewer,
So my command line lookl like this: C:WindowsSystem32wscript.exe D:Mtpathtestfile.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:wwwebsupportsoft.aumediage.beDownloadeee.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:wwwrootCREation2.vbs"; process1.StartInfo.FileName = "C:WINDOWSsystem32wscript.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]" wrote in message news:%233G6RRO$
"Gerald" wrote in message news:uwvGZEO$
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
When I try to to fire wscript.exe, I can see it in the process viewer,
So my command line lookl like this:
C:WindowsSystem32wscript.exe D:Mtpathtestfile.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.aumediage.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]" <willy.denoyette@telenet.be> wrote in message
news:%233G6RRO$FHA.740@TK2MSFTNGP12.phx.gbl...
"Gerald" <gege107@hotmail.com> wrote in message
news:uwvGZEO$FHA.208@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.
When I try to to fire wscript.exe, I can see it in the process viewer,
So my command line lookl like this: C:WindowsSystem32wscript.exe D:Mtpathtestfile.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:wwwebsupportsoft.aumediage.beDownloadeee.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:wwwrootCREation2.vbs"; process1.StartInfo.FileName = "C:WINDOWSsystem32wscript.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]" wrote in message news:%233G6RRO$
"Gerald" wrote in message news:uwvGZEO$
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
Zeya
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.
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
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.
Willy Denoyette [MVP]
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:WINDOWSsystem32cscript.exe"; Or better throws away this script and use the framework IO classes, they are made for this.
Willy.
"Gerald" wrote in message news:uMAaaiO$
When I try to to fire wscript.exe, I can see it in the process viewer,
So my command line lookl like this: C:WindowsSystem32wscript.exe D:Mtpathtestfile.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:wwwebsupportsoft.aumediage.beDownloadeee.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:wwwrootCREation2.vbs"; process1.StartInfo.FileName = "C:WINDOWSsystem32wscript.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]" wrote in message news:%233G6RRO$
"Gerald" wrote in message news:uwvGZEO$
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
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" <gege107@hotmail.com> wrote in message
news:uMAaaiO$FHA.3308@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:WindowsSystem32wscript.exe D:Mtpathtestfile.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.aumediage.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]" <willy.denoyette@telenet.be> wrote in message
news:%233G6RRO$FHA.740@TK2MSFTNGP12.phx.gbl...
"Gerald" <gege107@hotmail.com> wrote in message
news:uwvGZEO$FHA.208@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.
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:WINDOWSsystem32cscript.exe"; Or better throws away this script and use the framework IO classes, they are made for this.
Willy.
"Gerald" wrote in message news:uMAaaiO$
When I try to to fire wscript.exe, I can see it in the process viewer,
So my command line lookl like this: C:WindowsSystem32wscript.exe D:Mtpathtestfile.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:wwwebsupportsoft.aumediage.beDownloadeee.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:wwwrootCREation2.vbs"; process1.StartInfo.FileName = "C:WINDOWSsystem32wscript.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]" wrote in message news:%233G6RRO$
"Gerald" wrote in message news:uwvGZEO$
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.