473,769 Members | 2,348 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Temporary ASP.NET Files Location?


I want to determine within my code-behind only the location of the
current tem directory for ym ASP.NET files. For example, the latest
web app build on my system shows:

"c:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \Temporary ASP.NET
Files\testapp\9 7e6075d\ca93f56 5\assembly\dl2\ d5f616ee\9e1410 d4_0348c401"

I know it is dynamic, but I want to determine what the current
directory is in-code.

Thanks.
Nov 18 '05 #1
5 4954
Hi Localhost,

From your description, you're wanting to get the location of the ASP.NET's
Temporary folder for the web application, yes?

Based on my research, by default when the asp.net been installed on the
machine, it is set to a default position in the system dir, such as
F:\WINDOWS\Micr osoft.NET\Frame work\v1.1.4322\ Temporary ASP.NET
Files\{Applicai ton Name}

And this path can be override by ourself in the machine.config or
web.config file in the <compilation> element which contains the
"tempDirect ory" attribute, you can view the following reference in MSDN on
this.

#<compilation> Element
http://msdn.microsoft.com/library/en...pilationsectio
n.asp?frame=tru e

But be careful that if we manually specify another path for this, we'd have
to ensure the asp.net worker process account has the sufficient permissions
to it. Otherwise, there'll occur many unexpected security issues.

Also, I haven't found any buildin interfaces for retrieving the temporary
folder path, I think this is apparent to the developer users. Also since it
is the internal mechanism of the ASP.NET and can't be guarantee whether
this will be changed in the later version, we're not recommended to make
use of this feature. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


Nov 18 '05 #2
Hi Localhost,

Have you had a chance to check out the suggestions in my last reply or have
you got any further ideas on this issue? If you have anything unclear or if
there're anything else we can help, please feel free to post here. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #3

I want to determine, at run-time within my application code, what
directory is being used by the current ASP.NET application.

I do not want to touch machine.config to make any changes to the
directory.

I do not want to hardcode F:\WINDOWS\.... directory in my code.

I understand that the directory can change in a later version of .NET
- that is why I want to dynamically detect where it is for the
currently running application.

If I use Windows Explorer to manually set the NTFS ACL to "Everyone -
Read" for the Temporary ASP.NET files directory, and then start a web
app, I will get an access denied message type - and the message will
show the exact filesystem directory. This example tells me that the
ASP.NET instance knows where it is running. Since ASP.NET knows this
location, there must be some way for me as a developer to determine it
dynamically. Maybe a Reflection class will be helpful?

In addtion, the exact path is not
:\WINDOWS\Micro soft.NET\Framew ork\v1.1.4322\T emporary ASP.NET
Files\{Applicai ton Name}" , it is actually
":\WINDOWS\Micr osoft.NET\Frame work\v1.1.4322\ Temporary ASP.NET
Files\{Applicai ton Name}\{RandomAp pKey}"

Could you please re-examine this issue?

Thanks.


On Wed, 02 Jun 2004 02:25:38 GMT, v-******@online.m icrosoft.com
(Steven Cheng[MSFT]) wrote:
Hi Localhost,

From your description, you're wanting to get the location of the ASP.NET's
Temporary folder for the web application, yes?

Based on my research, by default when the asp.net been installed on the
machine, it is set to a default position in the system dir, such as
F:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \Temporary ASP.NET
Files\{Applica iton Name}

And this path can be override by ourself in the machine.config or
web.config file in the <compilation> element which contains the
"tempDirectory " attribute, you can view the following reference in MSDN on
this.

#<compilatio n> Element
http://msdn.microsoft.com/library/en...pilationsectio
n.asp?frame=tr ue

But be careful that if we manually specify another path for this, we'd have
to ensure the asp.net worker process account has the sufficient permissions
to it. Otherwise, there'll occur many unexpected security issues.

Also, I haven't found any buildin interfaces for retrieving the temporary
folder path, I think this is apparent to the developer users. Also since it
is the internal mechanism of the ASP.NET and can't be guarantee whether
this will be changed in the later version, we're not recommended to make
use of this feature. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


Nov 18 '05 #4
Hi Localhost,

Thanks for your followup. Regarding on this issue, I'll consult some
further experts to see whether there is any workaround to get the temp dir
info. I'll update you as soon as I got any further info. Thanks.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #5
Hi Localhost,

After further researching, I think curently we can only use the Reflection
API to get the current executing assembly's path such as

using System.Reflecti on;
............... .......

Response.Write( "<br>" + Assembly.GetExe cutingAssembly( ).Location);

It'll give the dynamic assembly's full path , like:
f:\windows\micr osoft.net\frame work\v1.1.4322\ temporary asp.net
files\formautha pp\5ea2877c\82b 56ee2\assembly\ dl2\6333ec5f\60 f0576f_994ec401 \
formauthapp.dll

Thus, we can make use of this path to get the path info we want. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2191
by: poisondart | last post by:
Is there a way to dynamically generate temporary files (such as an html, xml or text file) in Python? I'm not sure if I'm explaining myself clearly as I've no clue how to describe this mechanism. I've seen it on certain websites that will generate a file under certain parameters (through forms) that will dissapear (i.e. delete itself) after a specified amount of time. These files usually have some phony string for their filenames...like...
1
2197
by: Allan Cammish | last post by:
I am writing a web based application that uses an ActiveX control on a web page to install files on the user's computer. These files will then be opened using programs on the user's computer such as WordPad. Some of the files will be also executed and delete the files which are not longer required. The files are not meant to be permanently left on the users computer, so there are by definition ‘temporary' files but will need to survive...
11
1908
by: Etienne Charland | last post by:
Hi, I have a solution containing 6 C# projects; 1 WinForms project and 5 class libraries. I didn't have any problems until recently. I added a new project containing reports. I am using ActiveReports.Net. Now, whenever I make a change to a report in the class library and recompile, I get this error: "Could not copy temporary files to the output directory.". I have to close VS.Net and reopen it in order to recompile, this is very cumbersome....
3
1793
by: Duff | last post by:
Hi all, i'd like to use several temporary files in my current C-project. I already tried to use "mkstemp" and "tempnam" functions. The problem is that my compiler warned me about the use of "tempnam" which seems to be dangerous... could someone help me with giving me pieces of advice concerning the use of temporary files in C ? Thanks a lot Duff
1
1236
by: poi | last post by:
I want to detect through code where the ASP.NET temporary files location is, or where the System TEMP directory is, so I can write temporary datasets to that location. Normally the user is ASPNET, so it doesn't have permission to use System.Management to detect the System Temp Environment Var. TIA. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
2
3144
by: Kiko + | last post by:
Hi, I've been getting this error: Server Error in '/applicationname' Application. ---------------------------------------------------------------------------- ---- Failed to create temporary files directory
1
1850
by: arkam | last post by:
Hi, I am building a solution containing one project and no special references. My dll just reached the 64KB "limit" and is 66KB now. When my DLL reached the 64KB limit IIS stopped releasing my DLL after an exception. I have to stop and start IIS to be able to build my solution again ! No MS KB article applies here because when my dll is only 63KB everything works !
0
1400
by: Stephen | last post by:
Hi all, based on the feedback from users and MSDN I was able to create a FileSystemWatcher app to monitor changes to a folder and subdirectories but there is one problem when a user saves a Excel file to a folder it creates a "temporary folder" and i am unable to capture it. i have captured temporary files like ".tmp" and "~wrd" but not able to capture "temp Folders" any suggestions?
1
3268
by: pcosway | last post by:
Core question: where does MySQL create temporary files in a quick rebuild? ( I thought I knew the answer, but now can't find them.) I'm trying to rebuild a file using "repair table <tablenamequick". It's worked fine in the past, but it doesn't seem to be rebuilding. "show processlist" does report the State is "Repair by sorting". I've been trying to monitor progress by looking at the temporary files being used in the rebuild, but I...
1
1287
by: twowaystosayiloveyou | last post by:
I am using VS2005 to build an ASP.net2.0 web site. After buidling from VS2005, where is the generated object files and temporary files? I cannot find anywhere. --?
0
9586
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10210
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.