Visual Studio .NET - where the temp directory is located ?

Asked By neel k on 22-Aug-08 07:09 AM
How can  find out where the temp directory is located ?

use this to know temp directory - Deepak Ghule replied to neel k on 22-Aug-08 07:12 AM

Hi Neel ,

U will know the temp directory by using Environment.GetEnvironmentVariable("TEMP").

e.g.

Response.Write("The TEMP environment variable is : " & Environment.GetEnvironmentVariable("TEMP"))

temp directory - pravin kumar S replied to neel k on 22-Aug-08 07:20 AM

you can cheak any directory using

Environment.GetEnvironmentVariable("directory name").

"Temporary ASP.NET Files" folder - mv ark replied to neel k on 22-Aug-08 07:32 AM

By default, when you compile a Web application the compiled code is placed in the Temporary ASP.NET Files folder. This folder is a subdirectory of the location where you installed the .NET framework. Typically, the location is the following:
%SystemRoot%\Microsoft.NET\Framework\versionNumber\Temporary ASP.NET Files

If you are looking for the "Temporary ASP.NET Files" or the compilation Folder location for the current application, you can extract it from this:
Response.Write(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase))

Use this - Atul Shinde replied to neel k on 22-Aug-08 07:42 AM

Environment.GetEnvironmentVariable("TEMP");

It will give the temporary directory for the user which is logged into the system.

e.g. It shows directory if Administrator login as

C:\Documents and Settings\Administrator\Local Settings\Temp

See this to find out Temp Directory - Sagar P replied to neel k on 22-Aug-08 08:00 AM

<%
Response.Write("The TEMP environment variable is : " & Environment.GetEnvironmentVariable("TEMP"))
%>

For .Net Framework 2.0 :
bootdrive:\%windir%\Microsoft.NET\Framework\v2.0.5 0727\Temporary ASP.NET Files

For .Net Framework 1.1 :
bootdrive:\%windir%\Microsoft.NET\Framework\v1.1.4 322\Temporary ASP.NET Files

This is a real hack, but it will retrieve the Temp directory path programmatically :

In global.asax :

Sub Application_OnStart()
Dim MyArray() As String = Split(AppDomain.CurrentDomain.DynamicDirectory, "\")
Application("TEMP_DIR") = (MyArray(0).ToString() & "/" & MyArray(1).ToString() & "/" _
& MyArray(2).ToString() & "/" & MyArray(3).ToString()) & "/" & MyArray(4).ToString() & "/" _
& MyArray(5).ToString())
End Sub

The path to the machine's ASP.NET Temporary Files directory
is now contained by Application("TEMP_DIR").

Best Luck!!!!!!!!!!!!!!!!!
Sujit.

reply - Binny ch replied to neel k on 22-Aug-08 09:23 AM

C:\Documents and Settings\Administrator\Local Settings\Temp\

or

Go to run--> enter %temp%

U'l get the temp directory opened

Copy the path.

Use this - Atul Shinde replied to neel k on 25-Aug-08 01:25 AM

<%
Response.Write("The TEMP environment variable is : " & Environment.GetEnvironmentVariable("TEMP"))
%>

For .Net Framework 2.0 :
bootdrive:\%windir%\Microsoft.NET\Framework\v2.0.5 0727\Temporary ASP.NET Files

For .Net Framework 1.1 :
bootdrive:\%windir%\Microsoft.NET\Framework\v1.1.4 322\Temporary ASP.NET Files

This is a real hack, but it will retrieve the Temp directory path programmatically :

In global.asax :

Sub Application_OnStart()
Dim MyArray() As String = Split(AppDomain.CurrentDomain.DynamicDirectory, "\")
Application("TEMP_DIR") = (MyArray(0).ToString() & "/" & MyArray(1).ToString() & "/" _
& MyArray(2).ToString() & "/" & MyArray(3).ToString()) & "/" & MyArray(4).ToString() & "/" _
& MyArray(5).ToString())
End Sub

The path to the machine's ASP.NET Temporary Files directory
is now contained by Application("TEMP_DIR").