473,748 Members | 2,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

temp directory question

Hi,

In my application I need to write an XML file to disk, but am concerned that
permission might be a problem.

The file only needs to be written out and used for another reason and can
then be deleted.

I was thinking about using the windows/system temp directory as the
location, as I guess that a directory where my application shouldn't have an
issue writting to.

Is this the best location for this file to go? and how do I determine what
the temp directory is ?

Thanks

Apr 6 '08 #1
6 1964
The location and the purpose look suitable to me
you can use My.Computer.Fil eSystem.Special Directories to find the temp dir
and other "special directories"

you can also use System.Environm ent.GetFolderPa th() to get the path of any
of the windows folders as listed in the System.Environm ent.SpecialFold er
enumeration.

hth

Michel
"Aussie Rules" <au****@nospam. comschreef in bericht
news:uG******** ******@TK2MSFTN GP06.phx.gbl...
Hi,

In my application I need to write an XML file to disk, but am concerned
that permission might be a problem.

The file only needs to be written out and used for another reason and can
then be deleted.

I was thinking about using the windows/system temp directory as the
location, as I guess that a directory where my application shouldn't have
an issue writting to.

Is this the best location for this file to go? and how do I determine what
the temp directory is ?

Thanks

Apr 6 '08 #2
On Apr 6, 8:13 am, "Aussie Rules" <aus...@nospam. comwrote:
Hi,

In my application I need to write an XML file to disk, but am concerned that
permission might be a problem.

The file only needs to be written out and used for another reason and can
then be deleted.

I was thinking about using the windows/system temp directory as the
location, as I guess that a directory where my application shouldn't have an
issue writting to.

Is this the best location for this file to go? and how do I determine what
the temp directory is ?

Thanks
If you have any difficulty about writing to a specific folder such as
temp (plus you may able to write), create your own temp folder in your
application folder then delete folder / file after operation has
finished.

For example when you need a folder temporarily, create a new one
using:
System.IO.Direc tory.CreateDire ctory("c:\your_ app\your_folder ")

Then you can delete folder fairly after the directory is not needed
anylonger using:
(usually when formclosing event is fired)
System.IO.Direc tory.Delete("c: \your_app\your_ folder")

Therefore you have a folder that's created and deleted temporarily,
just my opinion.

Regards,

Onur Güzel
Apr 6 '08 #3
"Aussie Rules" <au****@nospam. comschrieb:
Is this the best location for this file to go? and how do I determine what
the temp directory is ?
'System.IO.Path .GetTempPath'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Apr 6 '08 #4
This will cause you a problem in Windows Vista if your application is
installed in ProgramFiles. A better choice would be to put the file in the
local app data, which is under the user's profile --
Environment.Spe cialFolder.Loca lApplicationDat a.

RobinS.
GoldMail.com

"kimiraikko nen" <ki************ *@gmail.comwrot e in message
news:11******** *************** ***********@a1g 2000hsb.googleg roups.com...
On Apr 6, 8:13 am, "Aussie Rules" <aus...@nospam. comwrote:
Hi,

In my application I need to write an XML file to disk, but am concerned
that
permission might be a problem.

The file only needs to be written out and used for another reason and can
then be deleted.

I was thinking about using the windows/system temp directory as the
location, as I guess that a directory where my application shouldn't have
an
issue writting to.

Is this the best location for this file to go? and how do I determine what
the temp directory is ?

Thanks
If you have any difficulty about writing to a specific folder such as
temp (plus you may able to write), create your own temp folder in your
application folder then delete folder / file after operation has
finished.

For example when you need a folder temporarily, create a new one
using:
System.IO.Direc tory.CreateDire ctory("c:\your_ app\your_folder ")

Then you can delete folder fairly after the directory is not needed
anylonger using:
(usually when formclosing event is fired)
System.IO.Direc tory.Delete("c: \your_app\your_ folder")

Therefore you have a folder that's created and deleted temporarily,
just my opinion.

Regards,

Onur Güzel

Apr 7 '08 #5
On Apr 7, 8:42 am, "RobinS" <rob...@imnotte lling.comwrote:
This will cause you a problem in Windows Vista if your application is
installed in ProgramFiles. A better choice would be to put the file in the
local app data, which is under the user's profile --
Environment.Spe cialFolder.Loca lApplicationDat a.

RobinS.
GoldMail.com

"kimiraikko nen" <kimiraikkone.. .@gmail.comwrot e in message

news:11******** *************** ***********@a1g 2000hsb.googleg roups.com...
On Apr 6, 8:13 am, "Aussie Rules" <aus...@nospam. comwrote:
Hi,
In my application I need to write an XML file to disk, but am concerned
that
permission might be a problem.
The file only needs to be written out and used for another reason and can
then be deleted.
I was thinking about using the windows/system temp directory as the
location, as I guess that a directory where my application shouldn't have
an
issue writting to.
Is this the best location for this file to go? and how do I determine what
the temp directory is ?
Thanks

If you have any difficulty about writing to a specific folder such as
temp (plus you may able to write), create your own temp folder in your
application folder then delete folder / file after operation has
finished.

For example when you need a folder temporarily, create a new one
using:
System.IO.Direc tory.CreateDire ctory("c:\your_ app\your_folder ")

Then you can delete folder fairly after the directory is not needed
anylonger using:
(usually when formclosing event is fired)
System.IO.Direc tory.Delete("c: \your_app\your_ folder")

Therefore you have a folder that's created and deleted temporarily,
just my opinion.

Regards,

Onur Güzel
I'm not familiar with Vista at the moment so i don't know what you
meant about what it causes, but you must be able to create and delete
your own folders with no problem in XP and olders in program files.
Maybe program files is protected in Vista. Thanks for the info.

But with same logic you can dynamically create / delete a folder in a
writable location such as you mentioned.
Apr 7 '08 #6
Kimi,

Just the simple way as Herfried wrote is in my idea the solution here.

Cor

"kimiraikko nen" <ki************ *@gmail.comschr eef in bericht
news:26******** *************** ***********@p25 g2000hsf.google groups.com...
On Apr 7, 8:42 am, "RobinS" <rob...@imnotte lling.comwrote:
This will cause you a problem in Windows Vista if your application is
installed in ProgramFiles. A better choice would be to put the file in
the
local app data, which is under the user's profile --
Environment.Spe cialFolder.Loca lApplicationDat a.

RobinS.
GoldMail.com

"kimiraikko nen" <kimiraikkone.. .@gmail.comwrot e in message

news:11******** *************** ***********@a1g 2000hsb.googleg roups.com...
On Apr 6, 8:13 am, "Aussie Rules" <aus...@nospam. comwrote:
Hi,
In my application I need to write an XML file to disk, but am concerned
that
permission might be a problem.
The file only needs to be written out and used for another reason and
can
then be deleted.
I was thinking about using the windows/system temp directory as the
location, as I guess that a directory where my application shouldn't
have
an
issue writting to.
Is this the best location for this file to go? and how do I determine
what
the temp directory is ?
Thanks

If you have any difficulty about writing to a specific folder such as
temp (plus you may able to write), create your own temp folder in your
application folder then delete folder / file after operation has
finished.

For example when you need a folder temporarily, create a new one
using:
System.IO.Direc tory.CreateDire ctory("c:\your_ app\your_folder ")

Then you can delete folder fairly after the directory is not needed
anylonger using:
(usually when formclosing event is fired)
System.IO.Direc tory.Delete("c: \your_app\your_ folder")

Therefore you have a folder that's created and deleted temporarily,
just my opinion.

Regards,

Onur Güzel
I'm not familiar with Vista at the moment so i don't know what you
meant about what it causes, but you must be able to create and delete
your own folders with no problem in XP and olders in program files.
Maybe program files is protected in Vista. Thanks for the info.

But with same logic you can dynamically create / delete a folder in a
writable location such as you mentioned.
Apr 7 '08 #7

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

Similar topics

3
27739
by: Adam Parkin | last post by:
I was wondering, what's the "proper" (hehe) way to retrieve the system's temp directory in VB 6. Like for example, on my Windows XP machine the temp directory that is used by programs for their temporary files is "C:\Documents And Settings\MyUserName\Local Settings\Temp". Somehow those programs must look up that value, and I'd like to do the same for my VB program. Now I know I can look this up in the registry under...
1
2029
by: john bailo | last post by:
I noticed for the first time there is a temp directory in the \winnt\system32 directory. For a web services application, this caused me grief as when the server c: drive filled up, the temp directory couldn't hold the necessary temp files for the application. Is there a feature in dotnet to configure this
0
399
by: Matthew Fitzpatrick | last post by:
My application has a settings class that is serialized to save and deserialized to load. I'm having a problem where i catch the WM_QUERYENDSESSION event via WinProc to save my application's settings when a user logs out, reboots or shuts down the system. The behavior of XmlSerializer is that it creates temporary dll's to do the (de)serialization in the system's temp directory. The behavior of windows on a system shutdown is to purge...
5
2664
by: Patrick | last post by:
Hello - I am working on a program that creates a small temp file. The ideal would be it creates the file in the user %temp% directory - whatever that is - the default is %USERPROFILE%\Local Settings\Temp. Is there an easy way to set a variable to the users %TEMP% directory in Visual Basic .NET?
10
60717
by: Dieter Salath? | last post by:
Hi, in our webpage, a user could open a windows explorer to his temp directory with a simple link and usage of the file protocol: <a href="file://C:\temp" target="_blank">C:\temp</a> This worked very well a long time, but now it does not work anymore. We use IE6 and Microsoft Windows XP Professional 2002 SP2. I guess it has something to do with new IE security features. Does
10
4992
by: robwharram | last post by:
Hi, I'm quite frustrated in the fact that I can't even display a simple "Hello World" message on .Net. I've been through all of the groups and searched all over the place and haven't been able to figure out the solution to this problem. First off, the server is Windows Server 2003 - Web Edition (IIS 6) and I'm using .Net Framework v1.1.4322.
0
2361
by: Andrés G. Aragoneses | last post by:
When trying to use a webservices, not very often I obtain the following exception: Server was unable to process request. ---> Access to the temp directory is denied. Identity 'NT AUTHORITY\NETWORK SERVICE' under which XmlSerializer is running does not have sufficient permission to access the temp directory. CodeDom will use the user account the process is using to do the compilation, so if the user doesnt have access to system temp...
6
23265
by: Najd | last post by:
Hi All, I'm developping a DLL that requiers the path of the Temp directory of the user logged. I used GetTempPath(), GetEnvironmentVariable() and ExpandEnvironmentStrings(), but the 3 methodes returns the system temp path: "C:\WINDOWS\Temp". Did someone have another method or can explain me why it returns this path instead of the user path "C:\Documents and Settings\user\local settings\Temp". Note: When I used this 3 methods returns the...
0
4377
by: oritc123 | last post by:
Hello . I am having the following error when I run my application under Windows Vista ( it runs fine under Windows XP ) : "Access to the temp directory is denied. Identity 'ORITSLAPTOP\orit' under which XmlSerializer is running does not have sufficient permission to access the temp directory. CodeDom will use the user account the process is
0
9562
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
9386
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9333
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
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
4608
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
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3319
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
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.