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:
web server runs different user account (probably networkservice) http://www.bluevisionsoftware.com/website/tipsandtricksdetails.aspx?name=aspnetaccount
web server runs code without fulltrust permissions (probably medium trust) http://discussion.accuwebhosting.com/iis-web-server/993-how-grant-full-trust-mode-domain-asp-net-2-0-iis-6-0-a.html
both actions can compromise security, first 1 gives more choices fix setting acls.
Comments
Post a Comment