How? Granting elevated privileges to a web service / kill a process

Discussion in 'ASP .Net Web Services' started by Lee Gillie, May 12, 2005.

  1. Lee Gillie

    Lee Gillie Guest

    I need to be able to kill a process programmatically under ASP.NET. IIS
    runs under the local system account. The user accessing the web is using
    anonymous access.

    We would prefer NOT to grant elevated security to the proxy used for
    anonymous access. Is there a way to either establish a temporary
    security context, programmatically for the .NET Framework Process.Kill
    to operate under? Or perhaps a way to give the compiled binary produced
    this privilege? We may be willing to hard code a username credential in
    code in order to help limit the broad scope assignment of privileges.

    The need for this comes from what I believe to be a bug in EXCEL. We use
    automation in ASP.NET code. We wind everything down, call the various
    closes, and release all references, but we find the web server to be
    soon littered with many orphaned EXCEL processes. One for each instance
    made via automation.

    We have developed an approach to see the new EXCEL process being created
    at the very moment we instance EXCEL, and track the PID. When we have
    done absolutely everything we can to release the workbook, and close
    EXCEL, and it still has not gone away, then we kill the process. This
    has worked in many contexts, but falls on its face in an ASP.NET
    webservice due to the fact that it has insufficient privileges.

    Thanks for your help. Best regards - Lee Gillie, Spokane WA
    Lee Gillie, May 12, 2005
    #1
    1. Advertising

  2. He Lee,

    It seems to me that you'd want to create a special password-protected page
    and implement impersonation for that page. The impersonation would use the
    ID/password of an account that has sufficient privileges (admin?) to execute
    Process.Kill.

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsent7/html/vxconimpersonation.asp

    The account will have to have broad permissions:

    "SecurityPermission for calling any members of System.Diagnostic.Process
    with full trust. Associated enumeration: PermissionState.Unrestricted "

    "Lee Gillie" <> wrote in message
    news:...
    >I need to be able to kill a process programmatically under ASP.NET. IIS
    >runs under the local system account. The user accessing the web is using
    >anonymous access.
    >
    > We would prefer NOT to grant elevated security to the proxy used for
    > anonymous access. Is there a way to either establish a temporary security
    > context, programmatically for the .NET Framework Process.Kill to operate
    > under? Or perhaps a way to give the compiled binary produced this
    > privilege? We may be willing to hard code a username credential in code in
    > order to help limit the broad scope assignment of privileges.
    >
    > The need for this comes from what I believe to be a bug in EXCEL. We use
    > automation in ASP.NET code. We wind everything down, call the various
    > closes, and release all references, but we find the web server to be soon
    > littered with many orphaned EXCEL processes. One for each instance made
    > via automation.
    >
    > We have developed an approach to see the new EXCEL process being created
    > at the very moment we instance EXCEL, and track the PID. When we have done
    > absolutely everything we can to release the workbook, and close EXCEL, and
    > it still has not gone away, then we kill the process. This has worked in
    > many contexts, but falls on its face in an ASP.NET webservice due to the
    > fact that it has insufficient privileges.
    >
    > Thanks for your help. Best regards - Lee Gillie, Spokane WA
    Ken Cox [Microsoft MVP], May 13, 2005
    #2
    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. Shalini
    Replies:
    1
    Views:
    322
    Hernan de Lahitte
    Mar 5, 2004
  2. Lee Gillie
    Replies:
    1
    Views:
    834
    Ken Cox [Microsoft MVP]
    May 13, 2005
  3. News123
    Replies:
    2
    Views:
    2,629
    Tim Golden
    May 6, 2010
  4. Shalini

    Elevated Privileges Problem-Please Help

    Shalini, Mar 4, 2004, in forum: ASP .Net Security
    Replies:
    1
    Views:
    153
    Hernan de Lahitte
    Mar 5, 2004
  5. Shalini

    Elevated Privileges Problem-Please Help

    Shalini, Mar 4, 2004, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    125
    Hernan de Lahitte
    Mar 5, 2004
Loading...

Share This Page