Process.Start()

Discussion in 'ASP .Net' started by Robert Megee, Mar 8, 2005.

  1. Robert Megee

    Robert Megee Guest

    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
     
    Robert Megee, Mar 8, 2005
    #1
    1. Advertising

  2. 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

    --
    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
     
    Steve C. Orr [MVP, MCSD], Mar 8, 2005
    #2
    1. Advertising

  3. Robert Megee

    bruce barker Guest

    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
     
    bruce barker, Mar 9, 2005
    #3
  4. Robert Megee

    Guest

    To spawn an application from a Web Application on your server, you will
    probably have to Impersonate an admin/power account on the server.
     
    , Mar 9, 2005
    #4
  5. Robert Megee

    Robert Megee Guest

    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/d...-us/cpguide/html/cpconaspnetimpersonation.asp
     
    Robert Megee, Mar 9, 2005
    #5
  6. Robert Megee

    Robert Megee Guest

    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
    >
     
    Robert Megee, Mar 9, 2005
    #6
  7. Robert Megee

    ib00042

    Joined:
    Jul 24, 2007
    Messages:
    1
    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
     
    ib00042, Jul 24, 2007
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lucas Tam
    Replies:
    0
    Views:
    521
    Lucas Tam
    Jun 17, 2005
  2. Anup
    Replies:
    1
    Views:
    2,808
    Mark Rae
    May 9, 2006
  3. Noam Raphael
    Replies:
    17
    Views:
    531
    Noam Raphael
    May 26, 2004
  4. Jon Davis
    Replies:
    0
    Views:
    863
    Jon Davis
    Nov 14, 2006
  5. jpock76
    Replies:
    0
    Views:
    626
    jpock76
    Aug 23, 2010
Loading...

Share This Page