Remote Application Restart

J

Jeremy

Hello,

I have a reasonable amount of VB.net knowledge but my ASP.net skills
are in their infancy. I want to create what I assumed was not an
uncommon task that I could not accomplish in VB.net. I am attempting to
create an application that will enable me to stop and restart an
application on a remote machine. After taking the "VB.Net" approach in
an ASP.net page it became apperant that a little more is involved. I
can return a list of processes, but when I attempt to process.kill or
process.closemainwindow an exception is thrown. Note that this is
server side code, and the application I want to "kill" is on the
server. I have tried fiddling around with security..i.e. enabling
impersonation etc. to no avail.

After searching through a few threads here it appears as though ASP.net
simply cannot accomodate this functionality. And rather one should use
a web service to accomplish this.

Enough rambling...to my questions: Is it true that there is no way to
remotly restart an application with a simple ASP.net app?

If a web service is the answer does anyone know of a simple example as
I can only get web services to return values rather than perform tasks
(I have no experience here...)?

Thanks for your help!
Jeremy
 
S

Scott Allen

Hi Jeremy:

A web service has the same limitations as a WebForms application, and
runs under the same account. I still believe you face a security
barrier - what is the error message from the exception?
 
J

Jeremy

Hey Scott,

Thanks for helping out.

The following simple code...

For Each ps In ps.GetProcesses
lstApps.Items.Add(ps.ProcessName)
If ps.ProcessName = "notepad" Then
ps.Kill()
End If
Next

The process.kill statement generates the following exception:

ACCESS DENIED

System.ComponentModel.Win32Exception: Access is denied

What can I do to kill a process on the active desktop? I realize the
ASP.net user account has limited privilages and I have tried
impersonation...no effect.

Thanks again for your help.

Jeremy
 
S

Scott Allen

I did a little test and couldn't kill a process even when
impersonating a user, however, if I ran the process as the Local
System account (by changing machine.config) the code would kill the
process. It appears the impersonated identity isn't used when trying
to kill.

Running asp.net under the system account isn't a great idea, though,
so perhaps a better idea would be to spawn a process like kill.exe
under an admin account if you really need to do this.

See:

How to spawn a process that runs under the context of the impersonated
user in Microsoft ASP.NET pages
http://support.microsoft.com/default.aspx?scid=kb;EN-US;889251
 

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

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top