c# - different results for web and desktop applications for same code -


i have following piece of code.

it returning different results when running on same machine in case of web , desktop applications.

here code. please guide me on regarding this???

    var searcher = new managementobjectsearcher("select * win32_physicalmedia");      return (from managementobject wmihd in searcher.get()             select wmihd["serialnumber"] == null ? "vm hd" : wmihd["serialnumber"].tostring()).tolist(); 

here linq-free version of same code

    var hdcollection = new list<string>();     var searcher = new managementobjectsearcher("select * win32_physicalmedia");      foreach (managementobject wmihd in searcher.get())     {         // hardware serial no.         if (wmihd["serialnumber"] == null)         {             hdcollection.add("vm hd");         }         else         {             hdcollection.add(wmihd["serialnumber"].tostring());         }     }     return hdcollection; 

that possibly caused 2 things:

both actions can compromise security, first 1 gives more choices fix setting acls.


Comments