By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,678 Members | 1,146 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,678 IT Pros & Developers. It's quick & easy.

Problem using Process.start to shell

P: n/a
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
Share this Question
Share on Google+
6 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.