ASP.NET关进程的方法
2007-10-25 00:54
162 查看
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Diagnostics;
public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Button1.Attributes.Add("onclick", "javascript: return confirm('你真的要杀死这个进程吗?');");
if (!IsPostBack)
{
ArrayList list = new ArrayList();
foreach (Process thisproc in Process.GetProcesses())
{
string name = thisproc.ToString();
int j = name.IndexOf("(") + 1;
int i = name.IndexOf(")");
string newname = name.Substring(j, i - j);
list.Add(newname);
}
this.DropDownList1.DataSource = list;
this.DropDownList1.DataBind();
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string name = this.DropDownList1.SelectedItem.Text;
foreach (Process thisproc in Process.GetProcessesByName(name))
{
if (!thisproc.CloseMainWindow())
{
thisproc.Kill();
}
}
}
}
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Diagnostics;
public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Button1.Attributes.Add("onclick", "javascript: return confirm('你真的要杀死这个进程吗?');");
if (!IsPostBack)
{
ArrayList list = new ArrayList();
foreach (Process thisproc in Process.GetProcesses())
{
string name = thisproc.ToString();
int j = name.IndexOf("(") + 1;
int i = name.IndexOf(")");
string newname = name.Substring(j, i - j);
list.Add(newname);
}
this.DropDownList1.DataSource = list;
this.DropDownList1.DataBind();
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string name = this.DropDownList1.SelectedItem.Text;
foreach (Process thisproc in Process.GetProcessesByName(name))
{
if (!thisproc.CloseMainWindow())
{
thisproc.Kill();
}
}
}
}
相关文章推荐
- 关于ASP.NET中调用Excel组件不能结束进程的解决方法
- 关于ASP.NET中调用Excel组件不能结束进程的解决方法
- C#和Asp.net下调用Excel后无法自动关闭进程的解决方法
- 黑马程序员_学习日记65_713ASP.NET(委托、托管、扩展方法、泛型委托、进程_应用程序域_线程、多线程、异步委托)
- ASP.NET调用Excel不能结束进程的解决方法
- 关于ASP.NET MVC中Response.Redirect和RedirectToAction的BUG (跳转后继续执行后面代码而不结束进程)以及处理方法
- ASP.net:四种进程或线程同步互斥的控制方法
- "用于运行 ASP.NET 的进程帐户必须具有对 IIS 元数据库"的原因及解决方法
- asp.net 操作服务器Excel后,关闭服务器Excel进程有效方法
- Asp.net项目路径获取方法
- 用于运行 ASP.NET 的进程帐户必须具有对 IIS 元数据库错误
- asp.net中常用的26个优化性能的方法
- asp.net里导出excel表方法汇总
- ASP.NET生成二维码的方法总结
- ASP.NET缓存:方法和最佳实践 http://blog.csdn.net/eqiang8271/archive/2007/10/24/1841149.aspx
- Asp.net页面之间传递参数的几种方法荟萃
- asp.net 用户控件中 使用相对路径的解决方法-------- 图片路径问题(用户控件、图片路径) ,ResolveUrl
- Asp.net中防止用户多次登录的方法
- 用于运行 ASP.NET 的进程帐户必须具有对 IIS 元数据库(如 IIS://servername/W3SVC)的读访问权
- asp.net下载的方法