views:

86

answers:

1

In our office we have a 40" LCD mounted to the wall that runs a full screen instance of Firefox that in turn hosts a series of modules. Each of these modules is a self contained DIV with an AJAX interface (through jQuery) to the server to perform it's function.

One of these modules monitors our servers CPU, memory and disk usage.

On the server side we used to use WMI, but with a re-write are trying to make use of the PerformanceCounter class in .net.

However the problem with the PerformanceCounter class is that the default IIS anonymous account don't have the rights to recieve the required information.

I have an account with the rights to retrieve these stats and tried to use the:

<identity impersonate="true" ...account details... />

However this prevented IIS from running anything, so I'm guessing the account didn't have permissions on the web server.

Basically what I'm after is an easy way to impersonate another account when using PerformanceCounter, as I could under WMI.

A: 

Two ideas for you:

  • You could temporarily impersonate a user with the right access.
  • You could create a windows service to interrogate the PerformanceCounters, and use WCF to communicate with the service from your web app.
Kramii