Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 631613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:59:06+00:00 2026-05-13T19:59:06+00:00

Currently, I use Path.GetTempPath() to figure out where to write my log files, but

  • 0

Currently, I use Path.GetTempPath() to figure out where to write my log files, but recently I came across a user’s machine where the path returned was not what I expected.

Usually, the returned path is C:\Documents and Settings\[userid]\Local Settings\Temp
but in this case, it was C:\Temp

This would not normally be a problem, but for some reason the user in question did not have access to write to C:\Temp

I double checked the environment variables, and the USER environment variable was pointing as expected to C:\Documents and Settings\[userid]\Local Settings\Temp, whilst the SYSTEM environment variable was pointing to C:\WINNT\Temp.

So… where is Path.GetTempPath() getting it’s value from ? Group Policy? Registry?

I have Googled, but to no avail.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T19:59:06+00:00Added an answer on May 13, 2026 at 7:59 pm

    (Using Reflector) Path.GetTempPath() ultimately calls the Win32 function GetTempPath (from kernel32.dll). The MDSN docs for this state:

    The GetTempPath function checks for the existence of environment variables in the following order and uses the first path found:

    • The path specified by the TMP environment variable.
    • The path specified by the TEMP environment variable.
    • The path specified by the USERPROFILE environment variable.
    • The Windows directory.

    Note that they also state that it doesn’t check whether or not the path actually exists or can be written to, so you may end up trying to write your log files to a path that doesn’t exist, or one that you cannot access.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently use this approach to load files in my applications: Path path =
I currently use, base64_encode() to encode a user's password, this works well because it
Below is the part code I currently use to write to a file, Try
I currently use Devise for user registration/authentication in a Rails project. When a user
I currently use LogonUser() to authenticate my user's username and password on my local
This is the URL path I currently use: /index.php?pid=211 I want to get the
I need to store some temporary files from my program sometimes, currently I use
I currently use Zend_Db to manage my queries $stmt = $db->prepare(INSERT INTO test (ID_Test)
I currently use Devise 2.1 + Rails 3.2.x to authenticate users. I'm also going
I currently use the rectangle shape xml tag to specify borders for my views

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.