473,466 Members | 1,334 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Shell problems

This is a re-post of an earlier problem which I have not been able to solve yet.
I'm running .NET 2003 on XP.
I am trying to launch a Windows program from a VB Web app.
The code I am using is;

Try
Dim psi As New System.Diagnostics.Process
psi.StartInfo.UseShellExecute = True
psi.StartInfo.WorkingDirectory = "c:\"
psi.StartInfo.FileName = "WinApp.exe"
psi.Start()
Catch
System.Diagnostics.Debug.WriteLine(Err.Number & ", " & Err.Description)
End Try
Exit Sub

The results are...
no Exception occurs
An audible chime sounds (sounds like Win * sound)
WinApp.exe appears in the Processes list of the Windows Task Manager
WinApp.exe fails to execute

I have tried the same code in .Net Windows VB and WinApp.exe executes.
There apparently is some difference in launching from a Web app that I haven't been able to figure out.

Any help would be deeply appreciated.

Thanks,
John F.

Nov 20 '05 #1
9 1627
Hi John,

Probably a user right, the Web application is standard running as the user
ASPNET, mostly is that the problem because that one has not so much rights
(should not have).

I hope that is it as well with you?

Cor
This is a re-post of an earlier problem which I have not been able to solve yet. I'm running .NET 2003 on XP.
I am trying to launch a Windows program from a VB Web app.
The code I am using is;

Try
Dim psi As New System.Diagnostics.Process
psi.StartInfo.UseShellExecute = True
psi.StartInfo.WorkingDirectory = "c:\"
psi.StartInfo.FileName = "WinApp.exe"
psi.Start()
Catch
System.Diagnostics.Debug.WriteLine(Err.Number & ", " & Err.Description)
End Try
Exit Sub

The results are...
no Exception occurs
An audible chime sounds (sounds like Win * sound)
WinApp.exe appears in the Processes list of the Windows Task Manager
WinApp.exe fails to execute

I have tried the same code in .Net Windows VB and WinApp.exe executes.
There apparently is some difference in launching from a Web app that I haven't been able to figure out.
Any help would be deeply appreciated.

Thanks,
John F.

Nov 20 '05 #2
* =?Utf-8?B?Sm9obiBG?= <Jo***@discussions.microsoft.com> scripsit:
This is a re-post of an earlier problem which I have not been able to solve yet.
I'm running .NET 2003 on XP.
I am trying to launch a Windows program from a VB Web app.
The code I am using is;

Try
Dim psi As New System.Diagnostics.Process
psi.StartInfo.UseShellExecute = True
psi.StartInfo.WorkingDirectory = "c:\"
psi.StartInfo.FileName = "WinApp.exe"
psi.Start()
Catch
System.Diagnostics.Debug.WriteLine(Err.Number & ", " & Err.Description)
End Try
Exit Sub

The results are...
no Exception occurs
An audible chime sounds (sounds like Win * sound)
WinApp.exe appears in the Processes list of the Windows Task Manager
WinApp.exe fails to execute


Is there an entry in the event log? Did you try to impersonate a user
with more rights? I doubt that the "ASPNET" user is allowed to launch
applications that are installed on your machine.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
Hi John,

I would never change the rights of the ASPNET user, that makes your server
almost an open server.

Try this question in the newsgroup

microsoft.public.dotnet.framework.security

Security is not something that has to be done in a language group in my
opinion.
However just my opinion.

Cor
Cor;

The user rights for ASPNET are Standard (Power Users Group).

Should this be OK?

Thanks

"Cor Ligthert" wrote:
Hi John,

Probably a user right, the Web application is standard running as the user ASPNET, mostly is that the problem because that one has not so much rights (should not have).

I hope that is it as well with you?

Cor
This is a re-post of an earlier problem which I have not been able to

solve yet.
I'm running .NET 2003 on XP.
I am trying to launch a Windows program from a VB Web app.
The code I am using is;

Try
Dim psi As New System.Diagnostics.Process
psi.StartInfo.UseShellExecute = True
psi.StartInfo.WorkingDirectory = "c:\"
psi.StartInfo.FileName = "WinApp.exe"
psi.Start()
Catch
System.Diagnostics.Debug.WriteLine(Err.Number & ", " & Err.Description) End Try
Exit Sub

The results are...
no Exception occurs
An audible chime sounds (sounds like Win * sound)
WinApp.exe appears in the Processes list of the Windows Task Manager
WinApp.exe fails to execute

I have tried the same code in .Net Windows VB and WinApp.exe executes. There apparently is some difference in launching from a Web app that I

haven't been able to figure out.

Any help would be deeply appreciated.

Thanks,
John F.


Nov 20 '05 #4
Unless you have overridden most of the security rights that the ASP.NET user is set to (not just the group), then the ASP.NET user will not be able to run an application that sits in the root directory. Try moving the WinApp.exe to a directory of the web site.

HTH

--
David Williams, VB.NET MVP
"John F" wrote:
This is a re-post of an earlier problem which I have not been able to solve yet.
I'm running .NET 2003 on XP.
I am trying to launch a Windows program from a VB Web app.
The code I am using is;

Try
Dim psi As New System.Diagnostics.Process
psi.StartInfo.UseShellExecute = True
psi.StartInfo.WorkingDirectory = "c:\"
psi.StartInfo.FileName = "WinApp.exe"
psi.Start()
Catch
System.Diagnostics.Debug.WriteLine(Err.Number & ", " & Err.Description)
End Try
Exit Sub

The results are...
no Exception occurs
An audible chime sounds (sounds like Win * sound)
WinApp.exe appears in the Processes list of the Windows Task Manager
WinApp.exe fails to execute

I have tried the same code in .Net Windows VB and WinApp.exe executes.
There apparently is some difference in launching from a Web app that I haven't been able to figure out.

Any help would be deeply appreciated.

Thanks,
John F.

Nov 20 '05 #5
* =?Utf-8?B?Sm9obiBG?= <Jo***@discussions.microsoft.com> scripsit:
Do you have sample code for impersonation that you could share?


I am not familiar with ASP.NET, so I currently don't have a sample, but
I know that this is a hot topic in the ASP.NET group.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #6
> This is a re-post of an earlier problem which I have not been able to
solve yet.
I'm running .NET 2003 on XP.
I am trying to launch a Windows program from a VB Web app.
[snippage]
The results are...
no Exception occurs
An audible chime sounds (sounds like Win * sound)
WinApp.exe appears in the Processes list of the Windows Task Manager
WinApp.exe fails to execute

I have tried the same code in .Net Windows VB and WinApp.exe executes.
There apparently is some difference in launching from a Web app that I

haven't been able to figure out.

heh. I get to write a "Dear John" letter:

I don't have empirical fact here, but I bet your WinApp.exe really is
executing.

I played (hacked, really) around with this a little bit and to me, it seems
like ASP.NET and COM+ EnterpriseServices both show the same behavior:

The launched application launches and remains in memory as if it is waiting
for a user to interact with it, but displays no UI. I don't know of a
solution, but as far as I can tell, that's what's happening. I would
recommend experimenting with calling a console application like PKZIP and
see if you can make it actually zip files, or if the process just loads and
hangs. If it actually does what it's supposed to do even without a UI, I
think you're OK.

Remember that ASP.NET has been designed so that stuff running at the server
can run without user intervention because at the web server, there is
probably not anyone looking at the screen. There is probably not anyone
even logged on at a server. So stuff that is designed to run on a server
can't have a UI.

You can also see this behavior in VB 6. If you make an ActiveX DLL in VB 6
that has a method that throws a MsgBox and compile it with the "unattended
execution" option, the MsgBox will run, but not on the screen, and you'll
see an item in the Application Event Log that describes what the MsgBox
*attempted* to display.

IMHO, you should not be launching user-interactive applications from ASP.NET
or from COM+. If you really want the user of your web application to be
able to launch this other application, try to find a way to do it
client-side, from the browser, like by using an ActiveX control that
provides the UI (remember, there's nothing stopping you from writing a WHOLE
program as an OCX, forms and all!), or by using .hta instead of .htm to be
able to run with full trust so that it can launch the other application.

A word about the ActiveX control idea: If you try this approach, be
*extremely* cautious about how you design it. If you give it a property
like "AppToLaunch" then it gets webified like this:

<object ....>
<param name="AppToLaunch" value="WinApp.exe">
</object>

Then you introduce a dangerous security threat because if I were a badguy, I
could get *your* control to run *my* app that is written to do all sorts of
horrible things.

Also, since launching one application from another *always* implies a
potential for security issues, have a chat with one of your network admins
about what you are planning to do; be warned in advance, your network admins
will sound justifiably paranoid about this. :)
--
Peace & happy computing,

Mike Labosh, MCSD
"SELECT * FROM Users WHERE Clue > 0"
Nov 20 '05 #7
> What I use it for is to send me a message on my cell phone (in this test
case I use Outlook express) if the Web app encounters problems. Just trying
to raise the service level during the testing phase of a new Web App.

Ahhhhh......

Here's a better solution then. In the MSPress "Visual Basic .NET
Programmer's Cookbook" on page 281, there is a discussion and howto about
sending SMTP mail. at this address is a self-extracing exe that contains
the companion content and code samples. You can dig out "recipe 8.12" to
see how to do this using the .Net Framework MailMessage class.

This will wrap:

http://download.microsoft.com/downlo...VBCookbook.exe
--
Peace & happy computing,

Mike Labosh, MCSD
"SELECT * FROM Users WHERE Clue > 0"
Nov 20 '05 #8
Mike;

Thanks for the tip.

I tried this, but threw Error #5, Could not access 'CDO.Message' object.

I used SmtpMail.SmtpServer = "smtp.prodigy.yahoo.com", which is a dialup connection and was connected.

Unless you see another approach, I'm going to try the socket approach described in
http://msdn.microsoft.com/library/de...un03282003.asp

This looks laborious. If you have other ideas I would appreciate receiving them.

Thanks,
John F.
"Mike Labosh" wrote:
What I use it for is to send me a message on my cell phone (in this test

case I use Outlook express) if the Web app encounters problems. Just trying
to raise the service level during the testing phase of a new Web App.

Ahhhhh......

Here's a better solution then. In the MSPress "Visual Basic .NET
Programmer's Cookbook" on page 281, there is a discussion and howto about
sending SMTP mail. at this address is a self-extracing exe that contains
the companion content and code samples. You can dig out "recipe 8.12" to
see how to do this using the .Net Framework MailMessage class.

This will wrap:

http://download.microsoft.com/downlo...VBCookbook.exe
--
Peace & happy computing,

Mike Labosh, MCSD
"SELECT * FROM Users WHERE Clue > 0"

Nov 20 '05 #9
Clarification;

I only want to SEND a message from the server-side of a Web app, which is why I tried using the shell process in the first place.

The reference I gave you is about Reading Email messages, but I will try to use the approach to do a Send.

Didn't want to mislead you about what I'm trying to do.

Thanks again,
John F.

"Mike Labosh" wrote:
What I use it for is to send me a message on my cell phone (in this test

case I use Outlook express) if the Web app encounters problems. Just trying
to raise the service level during the testing phase of a new Web App.

Ahhhhh......

Here's a better solution then. In the MSPress "Visual Basic .NET
Programmer's Cookbook" on page 281, there is a discussion and howto about
sending SMTP mail. at this address is a self-extracing exe that contains
the companion content and code samples. You can dig out "recipe 8.12" to
see how to do this using the .Net Framework MailMessage class.

This will wrap:

http://download.microsoft.com/downlo...VBCookbook.exe
--
Peace & happy computing,

Mike Labosh, MCSD
"SELECT * FROM Users WHERE Clue > 0"

Nov 20 '05 #10

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

Similar topics

4
by: Colin J. Williams | last post by:
PythonWin has been my favourite IDE for quite a while. When one right clicks on a .py file in the Windows Explorer, among the options are Open and Edit. The former is the default and executes...
0
by: Vitaliy | last post by:
I've installed perl 5.8.0 on my FreeBSD 4.8. The installation ran smoothly and without any problems. After I've tried to upgrade CPAN from shell (cpan> install Bundle::CPAN) as it was suggested...
2
by: Sin | last post by:
Hello everyone, I'm totally stumped at how little info I can find in MSDN or on the web concerning this. It's almost as if only microsoft personel hold the key to these secrets or something!!! ...
3
by: moondaddy | last post by:
I need to start an ms access 2003 app from a vb.net winforms app and didn't want to load all the interop stuff for office into the .net project. I thought that using the shell cmd would be a nice...
0
by: paulhjwu | last post by:
Hi, I have problems running a couple of shell scripts from PHP. I found a similar posting, so I posted my question to the original author. But unfortunately the original author is not at the...
1
by: kevin.a.sweeney | last post by:
I would like to open an application from a hyperlink on a webpage. 1. the webpage is located on my local machine. 2. the application is located on my local machine. 3. the application will run...
5
by: inetquestion | last post by:
I am looking for a web interface for shell commands or shell scripts. Does anyone know of any exexisting php scripts which would solve this requirement? PHP form accepts input from a user, then...
1
by: silas | last post by:
Hi! I had no expereince in coding a few months ago, and i didn't see the point either, thought it'd be rubbish! then when i had to study it for my collage course this year my god i took a liking...
3
by: James Bowyer | last post by:
I have the following code which works fine in XP but not in windows 7: ChDrive Dim openfolder As String openfolder = "explorer.exe " & & & "\" & & "\" & & " - " & Shell (openfolder)
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
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...
1
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...
0
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...
0
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...

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.