miraclemaker
Programmer
When I try and read a list of available performance counters from PerformanceCounterCategory.GetCategories() I get an 'access denied' error.
I'm very new to this, so please go easy on me.
Here's my code:
I'm running it on the localmachine, through a webbrowser on the same machine. I'm pretty sure it's something to do with my security policy, but I have security policy for stuff running on the local machine set to trust everything! Any ideas?
I'm very new to this, so please go easy on me.
Here's my code:
Code:
<% @Page Language="C#" Debug="true" %>
<% @Import Namespace="System.Diagnostics" %>
<% @Import Namespace="System.Collections" %>
<script language="C#" runat="server">
void Page_Load(Object Src, EventArgs E)
{
if (!Page.IsPostBack)
{
ArrayList arrItems = new ArrayList();
PerformanceCounterCategory[] arrCategories =
PerformanceCounterCategory.GetCategories();
for (int i=0; i < arrCategories.Length;i++)
arrItems.Add(arrCategories[i].CategoryName);
Category.DataSource = arrItems;
Category.DataBind();
}
}
</script>
<html>
<body>
<h3>Dump performance counter categories</h3>
<form runat="server" method="post">
Category:
<asp:dropdownlist id="Category" runat="server"/>
</form>
</body>
</html>
I'm running it on the localmachine, through a webbrowser on the same machine. I'm pretty sure it's something to do with my security policy, but I have security policy for stuff running on the local machine set to trust everything! Any ideas?