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 6137063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:40:48+00:00 2026-05-23T17:40:48+00:00

I have an odd problem… and I think I have narrowed it down to

  • 0

I have an odd problem… and I think I have narrowed it down to a point where we create a temporary file using Page.GetTempFileName().

I sometimes get a error message stating that Cannot create a file when that file already exists.

Is there a chance that using Path.GetTempFilename() could generate the same filename and become cached?

I am changing my code to use:

Path.Combine(System.IO.Path.GetTempPath(), string.Concat(Guid.NewGuid().ToString(), ".xls"));

In the hope that this will generate a unique filename, but I am concerned that the same problem may arise.

  • 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-23T17:40:49+00:00Added an answer on May 23, 2026 at 5:40 pm

    Path.GetTempFilename() creates an actual file on disk; depending on what you’re doing once you have that filename you could be triggering something. It’s written to return an actual file to avoid the race conditions associated with older temp filename methods from the past (notably tmpnam in the C standard library, for example.)

    Note that it will throw exceptions if there are more than 65,535 files created with this method without deleting them, or if it can’t generate a unique filename.

    So, what are you doing with that filename after you get it back from Path.GetTempFilename()?

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

Sidebar

Related Questions

We have an odd problem, we are tranforming a pretty complicated XML file using
I have an odd problem...I'm using a documentation generator which generates a lot of
I have an odd problem. I have a page called search.aspx. When the search
I'm using PuTTY to log into a Debian server. I have this odd problem
I have an odd problem with captureStillImageAsynchronouslyFromConnection. If I save the image using jpegStillImageNSDataRepresentation
I have a really odd problem. I am using an upload form to upload
I have a bit of an odd problem, and I'm struggling to track down
I have an odd problem with mapping in Vim. I am using an Azerty
I have an odd problem. I am using an AQGridView which has a method
I have a slightly odd problem that I think is most likely due to

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.