Author: TheAgus | Posted on: 9/1/2009 1:26:50 PM | Views : 302

I'm connecting to the local computer DNS Server through WMI, C# code.
After connected, when I pull the Properties for the WMI Class MicrosoftDNS_SERVER, I can see all the properties Name, but the Values are always NULL when I run the code from an ASP.NET application.
When I run the exact same code as a Console Application, it works, I obtain the values, not nulls. But I can't get them when I'm running it as an ASP.NET application. Why is this happening ? The web application is Full-Trust in the application web.config file.
The code is shown below. The issue is near the end, in the commented area, the value variable is always null in ASP.NET but it contains the actual value when run as a Console App.
System.Management.ConnectionOptions co = new ConnectionOptions(); System.Management.ManagementScope _scope = null; ...

Go to the complete details ...