473,414 Members | 1,679 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,414 software developers and data experts.

Problem using Process.start to shell

I have a VB .net 2.0 site that needs to run a dos app upon a button
click.

I found Shell too unreliable using parameters and so used
system.diagnostic.process.
simple troubleshooting example that opens up Notepad.....
Imports System.Diagnostics
Dim myProcess As New Process
Dim ShellCmd As String

ShellCmd = "notepad.exe"
myProcess.StartInfo.FileName = ShellCmd

myProcess.Start()

The code works fine - but only in debug mode - ie calling the browser
from the IDE (VS Web Dev express).
When I just use a browser - any browser, I get: an error .

Access is denied
at System.Diagnostics.Process.StartWithShellExecuteEx (ProcessStartInfo
startInfo)

When i set this up identically on my home machine it fails silently -
but still works from the IDE

Any ideas why this simple code would fail from a browser but run in
the IDE in debug mode?
Thanks

Bill
Jul 27 '06 #1
6 3204
Hi Bill,

I suspect that "Access is denied" means that the regular (non-debug) ASP.NET
account doesn't have sufficient permissions to execute that command.

When you're debugging in the IDE, I'd bet that you have privileges well
beyond those of mortal men. <grin>

I'm curious about one thing... if you do get Notepad to run outside the
environment, who is going to type the text and click Save? <grin>

Ken

<bi**@abc.comwrote in message
news:hb********************************@4ax.com...
>I have a VB .net 2.0 site that needs to run a dos app upon a button
click.

I found Shell too unreliable using parameters and so used
system.diagnostic.process.
simple troubleshooting example that opens up Notepad.....
Imports System.Diagnostics
Dim myProcess As New Process
Dim ShellCmd As String

ShellCmd = "notepad.exe"
myProcess.StartInfo.FileName = ShellCmd

myProcess.Start()

The code works fine - but only in debug mode - ie calling the browser
from the IDE (VS Web Dev express).
When I just use a browser - any browser, I get: an error .

Access is denied
at System.Diagnostics.Process.StartWithShellExecuteEx (ProcessStartInfo
startInfo)

When i set this up identically on my home machine it fails silently -
but still works from the IDE

Any ideas why this simple code would fail from a browser but run in
the IDE in debug mode?
Thanks

Bill

Jul 27 '06 #2
I did set permissions on the real command that I was trying to shell
( properties , security) - I added "Everyone" with full control and it
made no difference.
Is there another way to set permissions that I missed?

Bill


On Wed, 26 Jul 2006 22:31:38 -0400, "Ken Cox [Microsoft MVP]"
<BA**********@newsgroups.nospamwrote:
>Hi Bill,

I suspect that "Access is denied" means that the regular (non-debug) ASP.NET
account doesn't have sufficient permissions to execute that command.

When you're debugging in the IDE, I'd bet that you have privileges well
beyond those of mortal men. <grin>

I'm curious about one thing... if you do get Notepad to run outside the
environment, who is going to type the text and click Save? <grin>

Ken

<bi**@abc.comwrote in message
news:hb********************************@4ax.com.. .
>>I have a VB .net 2.0 site that needs to run a dos app upon a button
click.

I found Shell too unreliable using parameters and so used
system.diagnostic.process.
simple troubleshooting example that opens up Notepad.....
Imports System.Diagnostics
Dim myProcess As New Process
Dim ShellCmd As String

ShellCmd = "notepad.exe"
myProcess.StartInfo.FileName = ShellCmd

myProcess.Start()

The code works fine - but only in debug mode - ie calling the browser
from the IDE (VS Web Dev express).
When I just use a browser - any browser, I get: an error .

Access is denied
at System.Diagnostics.Process.StartWithShellExecuteEx (ProcessStartInfo
startInfo)

When i set this up identically on my home machine it fails silently -
but still works from the IDE

Any ideas why this simple code would fail from a browser but run in
the IDE in debug mode?
Thanks

Bill
Jul 27 '06 #3
Hi Bill,

You'll want to use impersonation in the web.config file. You need to
impersonate a Windows account that has the same rights as you do and that
can interact with the desktop.

<system.web>
<identity impersonate="true" userName="WindowsDomain\YourUserName"
password="YourPassword" />
</system.web>

Here's an article on doing the same programmatically:

http://west-wind.com/weblog/posts/1572.aspx

Ken
Microsoft MVP [ASP.NET]
<bi**@abc.comwrote in message
news:31********************************@4ax.com...
>I did set permissions on the real command that I was trying to shell
( properties , security) - I added "Everyone" with full control and it
made no difference.
Is there another way to set permissions that I missed?

Bill


On Wed, 26 Jul 2006 22:31:38 -0400, "Ken Cox [Microsoft MVP]"
<BA**********@newsgroups.nospamwrote:
>>Hi Bill,

I suspect that "Access is denied" means that the regular (non-debug)
ASP.NET
account doesn't have sufficient permissions to execute that command.

When you're debugging in the IDE, I'd bet that you have privileges well
beyond those of mortal men. <grin>

I'm curious about one thing... if you do get Notepad to run outside the
environment, who is going to type the text and click Save? <grin>

Ken

<bi**@abc.comwrote in message
news:hb********************************@4ax.com. ..
>>>I have a VB .net 2.0 site that needs to run a dos app upon a button
click.

I found Shell too unreliable using parameters and so used
system.diagnostic.process.
simple troubleshooting example that opens up Notepad.....
Imports System.Diagnostics
Dim myProcess As New Process
Dim ShellCmd As String

ShellCmd = "notepad.exe"
myProcess.StartInfo.FileName = ShellCmd

myProcess.Start()

The code works fine - but only in debug mode - ie calling the browser
from the IDE (VS Web Dev express).
When I just use a browser - any browser, I get: an error .

Access is denied
at System.Diagnostics.Process.StartWithShellExecuteEx (ProcessStartInfo
startInfo)

When i set this up identically on my home machine it fails silently -
but still works from the IDE

Any ideas why this simple code would fail from a browser but run in
the IDE in debug mode?
Thanks

Bill

Jul 27 '06 #4
a
Impersonation did not help.

Could this be some basic .Net or IIS security setting wrong on my part?

I have seen lots of seemingly easy to use examples of using Process.start on
the web so I don't understand why it should be so hard for me to start
notepad!

Bill
"Ken Cox [Microsoft MVP]" <BA**********@newsgroups.nospamwrote in message
news:Oz**************@TK2MSFTNGP04.phx.gbl...
Hi Bill,

You'll want to use impersonation in the web.config file. You need to
impersonate a Windows account that has the same rights as you do and that
can interact with the desktop.

<system.web>
<identity impersonate="true" userName="WindowsDomain\YourUserName"
password="YourPassword" />
</system.web>

Here's an article on doing the same programmatically:

http://west-wind.com/weblog/posts/1572.aspx

Ken
Microsoft MVP [ASP.NET]
<bi**@abc.comwrote in message
news:31********************************@4ax.com...
>>I did set permissions on the real command that I was trying to shell
( properties , security) - I added "Everyone" with full control and it
made no difference.
Is there another way to set permissions that I missed?

Bill


On Wed, 26 Jul 2006 22:31:38 -0400, "Ken Cox [Microsoft MVP]"
<BA**********@newsgroups.nospamwrote:
>>>Hi Bill,

I suspect that "Access is denied" means that the regular (non-debug)
ASP.NET
account doesn't have sufficient permissions to execute that command.

When you're debugging in the IDE, I'd bet that you have privileges well
beyond those of mortal men. <grin>

I'm curious about one thing... if you do get Notepad to run outside the
environment, who is going to type the text and click Save? <grin>

Ken

<bi**@abc.comwrote in message
news:hb********************************@4ax.com ...
I have a VB .net 2.0 site that needs to run a dos app upon a button
click.

I found Shell too unreliable using parameters and so used
system.diagnostic.process.
simple troubleshooting example that opens up Notepad.....
Imports System.Diagnostics
Dim myProcess As New Process
Dim ShellCmd As String

ShellCmd = "notepad.exe"
myProcess.StartInfo.FileName = ShellCmd

myProcess.Start()

The code works fine - but only in debug mode - ie calling the browser
from the IDE (VS Web Dev express).
When I just use a browser - any browser, I get: an error .

Access is denied
at System.Diagnostics.Process.StartWithShellExecuteEx (ProcessStartInfo
startInfo)

When i set this up identically on my home machine it fails silently -
but still works from the IDE

Any ideas why this simple code would fail from a browser but run in
the IDE in debug mode?
Thanks

Bill


Jul 27 '06 #5
Notepad is going to be rough to start because it presents a graphical
interface in a non-graphical environment.

"a" <aa@ss.comwrote in message
news:hR*****************@tornado.tampabay.rr.com.. .
Impersonation did not help.

Could this be some basic .Net or IIS security setting wrong on my part?

I have seen lots of seemingly easy to use examples of using Process.start
on the web so I don't understand why it should be so hard for me to start
notepad!

Bill
"Ken Cox [Microsoft MVP]" <BA**********@newsgroups.nospamwrote in
message news:Oz**************@TK2MSFTNGP04.phx.gbl...
>Hi Bill,

You'll want to use impersonation in the web.config file. You need to
impersonate a Windows account that has the same rights as you do and that
can interact with the desktop.

<system.web>
<identity impersonate="true" userName="WindowsDomain\YourUserName"
password="YourPassword" />
</system.web>

Here's an article on doing the same programmatically:

http://west-wind.com/weblog/posts/1572.aspx

Ken
Microsoft MVP [ASP.NET]
<bi**@abc.comwrote in message
news:31********************************@4ax.com.. .
>>>I did set permissions on the real command that I was trying to shell
( properties , security) - I added "Everyone" with full control and it
made no difference.
Is there another way to set permissions that I missed?

Bill


On Wed, 26 Jul 2006 22:31:38 -0400, "Ken Cox [Microsoft MVP]"
<BA**********@newsgroups.nospamwrote:

Hi Bill,

I suspect that "Access is denied" means that the regular (non-debug)
ASP.NET
account doesn't have sufficient permissions to execute that command.

When you're debugging in the IDE, I'd bet that you have privileges well
beyond those of mortal men. <grin>

I'm curious about one thing... if you do get Notepad to run outside the
environment, who is going to type the text and click Save? <grin>

Ken

<bi**@abc.comwrote in message
news:hb********************************@4ax.co m...
>I have a VB .net 2.0 site that needs to run a dos app upon a button
click.
>
I found Shell too unreliable using parameters and so used
system.diagnostic.process.
>
>
simple troubleshooting example that opens up Notepad.....
>
>
Imports System.Diagnostics
>
>
Dim myProcess As New Process
Dim ShellCmd As String
>
ShellCmd = "notepad.exe"
myProcess.StartInfo.FileName = ShellCmd
>
myProcess.Start()
>
>
>
The code works fine - but only in debug mode - ie calling the browser
from the IDE (VS Web Dev express).
When I just use a browser - any browser, I get: an error .
>
Access is denied
at System.Diagnostics.Process.StartWithShellExecuteEx (ProcessStartInfo
startInfo)
>
When i set this up identically on my home machine it fails silently -
but still works from the IDE
>
Any ideas why this simple code would fail from a browser but run in
the IDE in debug mode?
>
>
Thanks
>
Bill




Jul 27 '06 #6
a
ok but then it will better simulate my reall app I am trying to shell.

Trust me - I would would not waste so much energy trying to run Notepad :-)

If "Shell" can do it easily why can't Process.start?

Should I move this thread to the security group?

Bill

"Ken Cox [Microsoft MVP]" <BA**********@newsgroups.nospamwrote in message
news:uW**************@TK2MSFTNGP04.phx.gbl...
Notepad is going to be rough to start because it presents a graphical
interface in a non-graphical environment.

"a" <aa@ss.comwrote in message
news:hR*****************@tornado.tampabay.rr.com.. .
>Impersonation did not help.

Could this be some basic .Net or IIS security setting wrong on my part?

I have seen lots of seemingly easy to use examples of using Process.start
on the web so I don't understand why it should be so hard for me to start
notepad!

Bill
"Ken Cox [Microsoft MVP]" <BA**********@newsgroups.nospamwrote in
message news:Oz**************@TK2MSFTNGP04.phx.gbl...
>>Hi Bill,

You'll want to use impersonation in the web.config file. You need to
impersonate a Windows account that has the same rights as you do and
that can interact with the desktop.

<system.web>
<identity impersonate="true" userName="WindowsDomain\YourUserName"
password="YourPassword" />
</system.web>

Here's an article on doing the same programmatically:

http://west-wind.com/weblog/posts/1572.aspx

Ken
Microsoft MVP [ASP.NET]
<bi**@abc.comwrote in message
news:31********************************@4ax.com. ..
I did set permissions on the real command that I was trying to shell
( properties , security) - I added "Everyone" with full control and it
made no difference.
Is there another way to set permissions that I missed?

Bill


On Wed, 26 Jul 2006 22:31:38 -0400, "Ken Cox [Microsoft MVP]"
<BA**********@newsgroups.nospamwrote:

>Hi Bill,
>
>I suspect that "Access is denied" means that the regular (non-debug)
>ASP.NET
>account doesn't have sufficient permissions to execute that command.
>
>When you're debugging in the IDE, I'd bet that you have privileges well
>beyond those of mortal men. <grin>
>
>I'm curious about one thing... if you do get Notepad to run outside the
>environment, who is going to type the text and click Save? <grin>
>
>Ken
>
><bi**@abc.comwrote in message
>news:hb********************************@4ax.c om...
>>I have a VB .net 2.0 site that needs to run a dos app upon a button
>click.
>>
>I found Shell too unreliable using parameters and so used
>system.diagnostic.process.
>>
>>
>simple troubleshooting example that opens up Notepad.....
>>
>>
>Imports System.Diagnostics
>>
>>
> Dim myProcess As New Process
> Dim ShellCmd As String
>>
> ShellCmd = "notepad.exe"
> myProcess.StartInfo.FileName = ShellCmd
>>
> myProcess.Start()
>>
>>
>>
>The code works fine - but only in debug mode - ie calling the browser
>from the IDE (VS Web Dev express).
>When I just use a browser - any browser, I get: an error .
>>
>Access is denied
>at
>System.Diagnostics.Process.StartWithShellExec uteEx(ProcessStartInfo
>startInfo)
>>
>When i set this up identically on my home machine it fails silently -
>but still works from the IDE
>>
>Any ideas why this simple code would fail from a browser but run in
>the IDE in debug mode?
>>
>>
>Thanks
>>
>Bill
>



Jul 27 '06 #7

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

Similar topics

18
by: jas | last post by:
Hi, I would like to start a new process and be able to read/write from/to it. I have tried things like... import subprocess as sp p = sp.Popen("cmd.exe", stdout=sp.PIPE)...
2
by: jcrouse | last post by:
I apologize for starting another thread but the old one had a weird subject line. Anyways...here is the code: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As...
3
by: Rob | last post by:
Hi all, I am having trouble converting the code below (found on http://vbnet.mvps.org/index.html?code/core/sendmessage.htm) into a format that will work using vb .NET. Can anyone have a look...
5
by: Chris Austin | last post by:
I am trying to use the Shell command to run the MSDE setup. Shell("MSDE\setup.exe SAPWD=blah INSTANCENAME=TEST SECURITYMODE=SQL") This works in that it runs the setup, but the setup always pauses...
7
by: WALDO | last post by:
I wrote a console application that basically consumes arguments and starts other command line apps via System.Process. Let's call it XCompile for now. I wrote a Visual basic add-in that does pretty...
2
by: micahstrasser | last post by:
I have been trying for days to send a command to the command prompt through the shell() function in vb.net. For some reason it is not working. Here is the code: Private Sub Button1_Click(ByVal...
0
by: henning.friese | last post by:
Hello NG, I'm need to write some code which creates tiff files from various document types (doc, pdf, xls). I want to do this by ShellExecuting (via System.Diagnostics.Process) the doc-files...
9
by: dave m | last post by:
I have a small application that launches an application via the shell function when a listening socket receives data from another PC. This works fine using a WinForms environment. However, I...
5
by: Rob R. Ainscough | last post by:
I'm using the Diagnostics.Process approach to shelling out run the following: C:\Windows\System32\MSIEXEC.EXE /x {73F1BDB7-11E1-11D5-9DC6-00C04F2FC33B} /q ..FileName =...
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: 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
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
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...

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.