http://dotnet.aspx.cc/ShowDetail.aspx?id=299D1529-59A3-42F9-77A7-7BF353754FEA
通过ASP.NET可以对一些无用的进程进行远程杀死,下面的代码先列出正在活动的所有进程,然后进行杀死。需要注意的是:这个文件要放在具有Administrator访问权限的虚拟目录下。

以下是C#代码:

<script language="C#" runat="Server" debug="true"> void Page_Load(Object Sender, EventArgs e){ btnKill.Attributes.Add("onclick", "javascript: return confirm('你真的要杀死这个进程吗?');"); } private void KillProcess(string processName){ System.Diagnostics.Process myproc= new System.Diagnostics.Process(); //得到所有打开的进程 try{ foreach (Process thisproc in Process.GetProcessesByName(processName)) { if(!thisproc.CloseMainWindow()){ thisproc.Kill(); } } } catch(Exception Exc) { msg.Text+= "杀死" +procname.SelectedItem.Text + "失败!"; } } public void btnKill_Click(object sender, System.EventArgs e) { KillProcess(procname.SelectedItem.Text); msg.Text= procname.SelectedItem.Text +" 已经被杀死。"; } public void btnShow_Click(object sender, System.EventArgs e){ ArrayList procList =new ArrayList(); string tempName=""; int begpos; int endpos; foreach (Process thisProc in System.Diagnostics.Process.GetProcesses()) { tempName=thisProc.ToString(); begpos = tempName.IndexOf("(")+1; endpos= tempName.IndexOf(")"); tempName=tempName.Substring(begpos,endpos-begpos); procList.Add(tempName); } procname.DataSource=procList; procname.DataBind(); } </script><center> <h3>ASP.NET 进程杀死器!</h3> <br><table cellspacing="2" cellpadding="2" border="0" bgcolor="#fFCC66"><form> <tr> <td><dropdownlist></dropdownlist></td> <td> 进程名字</td> </tr> <tr> <td> <button></button> </td> <td> <button></button> </td> </tr> </form></table> <center><label></label></center> </center>

相关文章:

  • 2022-12-23
  • 2021-10-22
  • 2021-12-13
  • 2021-08-16
  • 2021-07-03
猜你喜欢
  • 2021-11-06
  • 2021-06-03
  • 2021-08-19
  • 2021-08-28
  • 2022-12-23
  • 2021-05-03
  • 2021-08-10
相关资源
相似解决方案