Click to See Complete Forum and Search --> : IE7 & IE8 - Administrator Rights?


m0sand
September 4th, 2009, 03:15 AM
Hi,

I'm developing an application that has several buttons for opening remote directories, and I use iexplore.exe to fire away explorer to get the directory listings and navigation because it has proven to be faster than listing the files directly in .NET (God knows why).

When running my application it runs as administrator but when I try to run IE7/IE8 those rights seems to be lost so I have to type in my credentials each time. Does anybody know a workaround for this?

m0sand
September 4th, 2009, 03:40 AM
I think I solved it myself :)

I stumbled across a MSDN Blog that explained the issue of admin rights:
http://blogs.msdn.com/aaron_margosis/archive/2004/07/07/175488.aspx

I reworked the application to use explorer.exe after editing a registry setting that allows Explorer.exe instances to run as separate processes which allows it to inherit administrator rights.


RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", true);
if ((int)key.GetValue("SeparateProcess") == 0)
{
key.SetValue("SeparateProcess", 1);
}


Hope this helps other people too!