Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Process.Start()

Reply
Thread Tools

Process.Start()

 
 
Robert Megee
Guest
Posts: n/a
 
      03-08-2005
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
 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      03-08-2005
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/de...ersonation.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net



"Robert Megee" <> wrote in message
news:...
>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



 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      03-09-2005
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)



"Robert Megee" <> wrote in message
news:...
| 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


 
Reply With Quote
 
recoil@community.nospam
Guest
Posts: n/a
 
      03-09-2005
To spawn an application from a Web Application on your server, you will
probably have to Impersonate an admin/power account on the server.

 
Reply With Quote
 
Robert Megee
Guest
Posts: n/a
 
      03-09-2005
I was actually trying to run an application on the client. I'll keep
this info for future reference so thanks.

Robert
On Tue, 8 Mar 2005 15:55:41 -0800, "Steve C. Orr [MVP, MCSD]"
<> wrote:

>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/de...ersonation.asp


 
Reply With Quote
 
Robert Megee
Guest
Posts: n/a
 
      03-09-2005
Thanks, I'll check out the permissions of that account.

Robert
On Tue, 8 Mar 2005 16:10:40 -0800, "bruce barker"
<> wrote:

>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)
>
>
>
>"Robert Megee" <> wrote in message
>news:.. .
>| 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
>


 
Reply With Quote
 
ib00042 ib00042 is offline
Junior Member
Join Date: Jul 2007
Posts: 1
 
      07-24-2007
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57