Access is Denied
I am trying to do an exercise in ASP.NET to get the "Getting Performance Information."
Every work is on my local machine and I have administrative access to the local machine.
This is my codes for click button event.
private void btnLoadProcessData_Click(object sender, System.EventArgs e)
{
//Clear all listbox
this.lbModules.Items.Clear();
this.lbProcesses.Items.Clear();
this.txtModuleInfo.Text = "";
//Get all the processes
Process[] arrProcesses = Process.GetProcesses(this.txtMachineName.Text);
foreach(Process p in arrProcesses)
{
//Add each process into the lvwProcesses
this.lbProcesses.Items.Add(p.Id.ToString() + " " + p.ProcessName);
}
}
Whenever I run my exercise, I get the error "Access is Denied" at this line "Process[] arrProcesses = Process.GetProcesses(this.txtMachineName.Text);"
Has anyone had this problem? Please help.
Thanks.
|