|
Hi!
I am having a typical problem ,I am using management classes to get the path for shared folders and files of the system.The code is working fine for console and winforms,but it is not working for web applications.I have tried giving admin rights to aspnet account,but the problem remains there.Please help
ManagementObjectSearcher searcher1=null;
searcher1=new ManagementObjectSearcher("SELECT * FROM Win32_Share");
try
{
foreach(ManagementObject share in searcher1.Get())
{
s=share["Path"].ToString();//for asp.net pages giving null obj ref exception
}
|
|
|
|
|
You might try to impersonate an user who can access the Path property of the ManagementObject instance:
<identity impersonate="true" userName="..." password="..."/>
|
|
|
|