Process.Start()

R

Robert Megee

I can't get Process.Start() to work from a Web application.
Is this because of the security settings in the browser?
Since this is for a private network, security isn't an issue.
Anyone know how to make this work or is there another way?

I've tried:

Process proc = new Process();
proc.StartInfo.Startfile = "c:\\winnt\\notepad.exe";
proc.Start();

and the basic way:

Process.Start("c:\\winnt\\notepad.exe");

It will complain if it can't find the file and dosn't give
anyerror or result if it can.
The code is is C#.

any clues?

Thanks,

Robert Megee
 
S

Steve C. Orr [MVP, MCSD]

Yes, your problem is almost certainly related to security.
First you must decide if you're trying to open notepad on the client or the
server.
You're going about things completely wrong if your goal is to open a file on
the client.
You're close if your going for the server, but the default ASPNET account
has no desktop on which to display any UI because it is intended to be a
stand alone windows service that operates when nobody is around to see any
UI. Therefore you'll only have luck running programs on the server if they
don't require any desktop interaction and the ASPNET user account has
permission to all the related folders. For this part of it you can use
impersonation.

For example, you can add a line similar to this to your web.config file:
<identity impersonate="true" userName="domain\MyAppUser">
password="password"/>

Here's more info on impersonation:
http://msdn.microsoft.com/library/d...-us/cpguide/html/cpconaspnetimpersonation.asp
 
B

bruce barker

for the webserver to start a process does not involve browser security.

in your case your test app (notepad.exe) can not be started from a
webservice because its a windows app and will not have permission to open a
window on the desktop, thus it exits right away.

note: if you use process.Start, the process will be created under the
asp.net service account (what asp.net process is running under), not the
creating thread's account.

-- bruce (sqlwork.com)



| I can't get Process.Start() to work from a Web application.
| Is this because of the security settings in the browser?
| Since this is for a private network, security isn't an issue.
| Anyone know how to make this work or is there another way?
|
| I've tried:
|
| Process proc = new Process();
| proc.StartInfo.Startfile = "c:\\winnt\\notepad.exe";
| proc.Start();
|
| and the basic way:
|
| Process.Start("c:\\winnt\\notepad.exe");
|
| It will complain if it can't find the file and dosn't give
| anyerror or result if it can.
| The code is is C#.
|
| any clues?
|
| Thanks,
|
| Robert Megee
 
R

recoil

To spawn an application from a Web Application on your server, you will
probably have to Impersonate an admin/power account on the server.
 
R

Robert Megee

I was actually trying to run an application on the client. I'll keep
this info for future reference so thanks.

Robert
 
Joined
Jul 24, 2007
Messages
1
Reaction score
0
How to define readonly permissions

Do you know if it's possible to define in the process.Start() that the file is read only? I need to specify this to interdict the user to change the file.
Thanks for your help.

R
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top