ASP.NET Temp directory

  • Thread starter Thread starter santos_sergio
  • Start date Start date
S

santos_sergio

Hi,


Does anyone know how to retrieve
"C:\WINDOWS\Microsoft.NET\Framework\{version}\Temporary ASP.NET Files"
directory name programmatically ?

Thanks in advance.

Sérgio Silva
 
string s = @"C:\WINDOWS\Microsoft.NET\Framework\{version}\Temporary ASP.NET
Files";

--
;-),

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.


Hi,


Does anyone know how to retrieve
"C:\WINDOWS\Microsoft.NET\Framework\{version}\Temporary ASP.NET Files"
directory name programmatically ?

Thanks in advance.

Sérgio Silva
 
Actually, what I meant to say was, it isn't stored somewhere, except in your
machine.config file. You could, I imagine, open the file as an XML document
and find the "tempDirectory" node under "compilation" under "system.web"
element to read it. I believe you can also override it in the web.config,
but you can't use the ConfigurationSettings class to read it. You would
still have to open it as an XML file.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.


Hi,


Does anyone know how to retrieve
"C:\WINDOWS\Microsoft.NET\Framework\{version}\Temporary ASP.NET Files"
directory name programmatically ?

Thanks in advance.

Sérgio Silva
 
In Kevin's example you would have to hard code the {version} of the .NET
framework you want to use and/or the folder path. As a catch all situation,
you could retrieve this location where your page is being loaded from by:
System.Reflection.Assembly.GetExecutingAssembly.Location.ToString()


Hi,


Does anyone know how to retrieve
"C:\WINDOWS\Microsoft.NET\Framework\{version}\Temporary ASP.NET Files"
directory name programmatically ?

Thanks in advance.

Sérgio Silva
 
Well, I've learned something today. :-D

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
Hi,

I choose to get it from current appdomain temporary directory.

AppDomain.CurrentDomain.SetupInformation.CachePath;

The return is C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary
ASP.NET Files\2.0.0_scriptenginehost\407724a3

It's fine with me.

Thanks to all
 
Back
Top