IEexec and CurrentDirectory


Another one from the internal aliases…


Q:



style="FONT-SIZE: 9pt; FONT-FAMILY: Arial">I launch my managed app in internet
explorer via command line as


style="FONT-SIZE: 9pt; FONT-FAMILY: Arial">C:\tmp> %programfiles%\Internet
Explorer\iexplore.exe
style="FONT-SIZE: 9pt; FONT-FAMILY: Arial"> href="http://mywebserver/myapp.exe"> lang=FR>http://mywebserver/myapp.exe


style="FONT-SIZE: 9pt; FONT-FAMILY: Arial">It looks to me that the
Environment.CurrentDirectory (as returned by myapp) for the IEexec process is
“Desktop”. Is that right?


style="FONT-SIZE: 9pt; FONT-FAMILY: Arial">Does anyone have any information
about the CurrentDirectory and IEexec process.


style="FONT-SIZE: 9pt; FONT-FAMILY: Arial"> 


style="FONT-SIZE: 9pt; FONT-FAMILY: Arial">A:

size=1>
The
following code:

size=2> 

size=2>   string envCurDir =
Environment.CurrentDirectory;
   Console.WriteLine(“Environment.CurrentDirectory
= {0}”, envCurDir);

 

   string baseDir =
AppDomain.CurrentDomain.BaseDirectory;
   Console.WriteLine(“AppDomain.CurrentDomain.BaseDirectory
= {0}”, baseDir);

 

size=2>generates this output when started from href="http://Server/iedownload/!/"> size=2>http://Server/iedownload/!/

size=2>    Environment.CurrentDirectory = C:\Documents and
Settings\konste\Desktop
    AppDomain.CurrentDomain.BaseDirectory =
href="http://Server/iedownload/!/"> size=2>http://Server/iedownload/!/

size=2> 

size=2>Probably you want just use AppDomain.CurrentDomain.BaseDirectory instead
of Environment.CurrentDirectory.

size=2> 

size=2>Additional consideration is that to use Environment.CurrentDirectory your
application must be given FileIOPermission in order to run from
Internet/Intranet location, while to use
class=754560019-02052003> size=2>AppDomain.CurrentDomain.BaseDirectory default permissions are
enough.

 

Comments (0)