By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,978 Members | 1,389 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,978 IT Pros & Developers. It's quick & easy.

Error calling Path.GetTempFileName(): The directory name is invalid

P: n/a
Why am I receiving the below error when calling - Path.GetTempFileName()
The directory name is invalid.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.IO.IOException: The directory name is invalid.

Jul 21 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Because your TEMP or TMP environment variable (for your web site's account)
is an invalid directory name?

Jerry

"Glenn A. Harlan" <ga******@hotmail.com> wrote in message
news:Hp********************@comcast.com...
Why am I receiving the below error when calling - Path.GetTempFileName()
The directory name is invalid.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.IO.IOException: The directory name is invalid.

Jul 21 '05 #2

P: n/a
Wouldn't that be the ASPNET user?
If so how do I set the environment for that User?
Jerry Pisk wrote:
Because your TEMP or TMP environment variable (for your web site's account)
is an invalid directory name?

Jerry

"Glenn A. Harlan" <ga******@hotmail.com> wrote in message
news:Hp********************@comcast.com...
Why am I receiving the below error when calling - Path.GetTempFileName()
The directory name is invalid.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.IO.IOException: The directory name is invalid.



Jul 21 '05 #3

P: n/a
Most likely it would be the ASPNET user. I'm not sure how to set that user's
environment (without writing code) but first check what the temp directory
is, Path.GetTempPath(). Check if the name is valid and the directory exists
and that ASPNET can write into it (but i think you'd get a different
exception if it was a permission issue).

Jerry

"Glenn A. Harlan" <ga******@hotmail.com> wrote in message
news:ZP********************@comcast.com...
Wouldn't that be the ASPNET user?
If so how do I set the environment for that User?
Jerry Pisk wrote:
Because your TEMP or TMP environment variable (for your web site's
account) is an invalid directory name?

Jerry

"Glenn A. Harlan" <ga******@hotmail.com> wrote in message
news:Hp********************@comcast.com...
Why am I receiving the below error when calling - Path.GetTempFileName()
The directory name is invalid.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.IO.IOException: The directory name is invalid.


Jul 21 '05 #4

P: n/a
The system environment Temp and Tmp are both set to "C:\WINDOWS\TEMP".
I'm running XP Professional. My user has Temp and Tmp set to:
%USERPROFILE%\Local Settings\Temp.
The Path.GetTempPath is showing the ASPNET user Local Temp.
In windows XP there doesn't seem to any place to specificaly set folder
permissions as in 2000 or 2003 Server for an individual user.

Jerry Pisk wrote:
Most likely it would be the ASPNET user. I'm not sure how to set that user's
environment (without writing code) but first check what the temp directory
is, Path.GetTempPath(). Check if the name is valid and the directory exists
and that ASPNET can write into it (but i think you'd get a different
exception if it was a permission issue).

Jerry

"Glenn A. Harlan" <ga******@hotmail.com> wrote in message
news:ZP********************@comcast.com...
Wouldn't that be the ASPNET user?
If so how do I set the environment for that User?
Jerry Pisk wrote:
Because your TEMP or TMP environment variable (for your web site's
account) is an invalid directory name?

Jerry

"Glenn A. Harlan" <ga******@hotmail.com> wrote in message
news:Hp********************@comcast.com...
Why am I receiving the below error when calling - Path.GetTempFileName()
The directory name is invalid.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.IO.IOException: The directory name is invalid.



Jul 21 '05 #5

P: n/a
You need to disable Simple file sharing under Folder Options to be able to
set permissions in WinXP.

If the ASPNET's temp directory is set to a valid path then I don't know what
might be causing the problem.

Jerry

"Glenn A. Harlan" <ga******@hotmail.com> wrote in message
news:IJ********************@comcast.com...
The system environment Temp and Tmp are both set to "C:\WINDOWS\TEMP". I'm
running XP Professional. My user has Temp and Tmp set to:
%USERPROFILE%\Local Settings\Temp.
The Path.GetTempPath is showing the ASPNET user Local Temp.
In windows XP there doesn't seem to any place to specificaly set folder
permissions as in 2000 or 2003 Server for an individual user.

Jerry Pisk wrote:
Most likely it would be the ASPNET user. I'm not sure how to set that
user's environment (without writing code) but first check what the temp
directory is, Path.GetTempPath(). Check if the name is valid and the
directory exists and that ASPNET can write into it (but i think you'd get
a different exception if it was a permission issue).

Jerry

"Glenn A. Harlan" <ga******@hotmail.com> wrote in message
news:ZP********************@comcast.com...
Wouldn't that be the ASPNET user?
If so how do I set the environment for that User?
Jerry Pisk wrote:

Because your TEMP or TMP environment variable (for your web site's
account) is an invalid directory name?

Jerry

"Glenn A. Harlan" <ga******@hotmail.com> wrote in message
news:Hp********************@comcast.com...
>Why am I receiving the below error when calling -
>Path.GetTempFileName()
>
>
>The directory name is invalid.
>Description: An unhandled exception occurred during the execution of
>the current web request. Please review the stack trace for more
>information about the error and where it originated in the code.
>
>Exception Details: System.IO.IOException: The directory name is
>invalid.
>


Jul 21 '05 #6

P: n/a
First off, thanks for all of your advice.

I changed the folder settings, and ASPNET is authorized to write to that
directory.
Path.GetTempPath() returns: C:\DOCUME~1\ATCS\ASPNET\LOCALS~1\Temp\
But, Path.GetTempFileName() still returns an Error, I pasted the info below.

The directory name is invalid.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.IO.IOException: The directory name is invalid.

Source Error:

Line 1847: // Get a temporary system filename
Line 1848: lFile = Path.GetTempPath();
Line 1849: lFile = Path.GetTempFileName();
Line 1850: File.Delete(lFile);
Line 1851: lPath = Path.GetPathRoot(lFile);
Source File: c:\development\visual studio
projects\system\utilities\utilities.cs Line: 1849

Stack Trace:

[IOException: The directory name is invalid.]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +723
System.IO.Path.GetTempFileName() +90
System.Utility.Utilities.GetFilename(String Prefix, String
Extention, Boolean AddDateStamp, Boolean AddTimeStamp) in
c:\development\visual studio projects\system\utilities\utilities.cs:1849
System.Utility.Utilities.GetFilename() in c:\development\visual
studio projects\system\utilities\utilities.cs:1799
System.Utility.TextFile.initializeClass(String File) in
C:\Development\Visual Studio Projects\System\Utilities\TextFile.cs:190
System.Utility.TextFile..ctor() in C:\Development\Visual Studio
Projects\System\Utilities\TextFile.cs:126
System.Utility.LogFile..ctor(String File) in C:\Development\Visual
Studio Projects\System\Utilities\LogFile.cs:75
System.Utility.TraceDebugListener..ctor(String Type) in
C:\Development\Visual Studio
Projects\System\Utilities\TraceDebugListener.cs:82
System.Utility.ListenerDebug..ctor() in C:\Development\Visual Studio
Projects\System\Utilities\ListenerDebug.cs:10
eRMS.Global.Session_Start(Object sender, EventArgs e) in
c:\inetpub\wwwroot\eRMSTest_NET\Global.asax.cs:73
System.Web.SessionState.SessionStateModule.RaiseOn Start(EventArgs e)
System.Web.SessionState.SessionStateModule.OnStart (EventArgs e)
System.Web.SessionState.SessionStateModule.Complet eAcquireState()
System.Web.SessionState.SessionStateModule.BeginAc quireState(Object
source, EventArgs e, AsyncCallback cb, Object extraData)

System.Web.AsyncEventExecutionStep.System.Web.Http Application+IExecutionStep.Execute()
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously) +173
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573;
ASP.NET Version:1.1.4322.573
Again, thanks for all of your help.

Jerry Pisk wrote:
You need to disable Simple file sharing under Folder Options to be able to
set permissions in WinXP.

If the ASPNET's temp directory is set to a valid path then I don't know what
might be causing the problem.

Jerry

"Glenn A. Harlan" <ga******@hotmail.com> wrote in message
news:IJ********************@comcast.com...
The system environment Temp and Tmp are both set to "C:\WINDOWS\TEMP". I'm
running XP Professional. My user has Temp and Tmp set to:
%USERPROFILE%\Local Settings\Temp.
The Path.GetTempPath is showing the ASPNET user Local Temp.
In windows XP there doesn't seem to any place to specificaly set folder
permissions as in 2000 or 2003 Server for an individual user.

Jerry Pisk wrote:
Most likely it would be the ASPNET user. I'm not sure how to set that
user's environment (without writing code) but first check what the temp
directory is, Path.GetTempPath(). Check if the name is valid and the
directory exists and that ASPNET can write into it (but i think you'd get
a different exception if it was a permission issue).

Jerry

"Glenn A. Harlan" <ga******@hotmail.com> wrote in message
news:ZP********************@comcast.com...
Wouldn't that be the ASPNET user?
If so how do I set the environment for that User?
Jerry Pisk wrote:
>Because your TEMP or TMP environment variable (for your web site's
>account) is an invalid directory name?
>
>Jerry
>
>"Glenn A. Harlan" <ga******@hotmail.com> wrote in message
>news:Hp********************@comcast.com...
>
>
>
>>Why am I receiving the below error when calling -
>>Path.GetTempFileName()
>>
>>
>>The directory name is invalid.
>>Description: An unhandled exception occurred during the execution of
>>the current web request. Please review the stack trace for more
>>information about the error and where it originated in the code.
>>
>>Exception Details: System.IO.IOException: The directory name is
>>invalid.
>>
>
>
>



Jul 21 '05 #7

P: n/a
Unless you changed the default directory structure there's one directory too
much in that path. I don't think that \ATCS\ should be there, that is unless
you moved your profiles from C:\Documents and Settings\ to C:\Documents and
Settings\ATCS\. If you didn't there's your problem.

Jerry

"Glenn A. Harlan" <ga******@hotmail.com> wrote in message
news:JM********************@comcast.com...
First off, thanks for all of your advice.

I changed the folder settings, and ASPNET is authorized to write to that
directory.
Path.GetTempPath() returns: C:\DOCUME~1\ATCS\ASPNET\LOCALS~1\Temp\
But, Path.GetTempFileName() still returns an Error, I pasted the info
below.

The directory name is invalid.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.IO.IOException: The directory name is invalid.

Source Error:

Line 1847: // Get a temporary system filename
Line 1848: lFile = Path.GetTempPath();
Line 1849: lFile = Path.GetTempFileName();
Line 1850: File.Delete(lFile);
Line 1851: lPath = Path.GetPathRoot(lFile);
Source File: c:\development\visual studio
projects\system\utilities\utilities.cs Line: 1849

Stack Trace:

[IOException: The directory name is invalid.]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +723
System.IO.Path.GetTempFileName() +90
System.Utility.Utilities.GetFilename(String Prefix, String Extention,
Boolean AddDateStamp, Boolean AddTimeStamp) in c:\development\visual
studio projects\system\utilities\utilities.cs:1849
System.Utility.Utilities.GetFilename() in c:\development\visual studio
projects\system\utilities\utilities.cs:1799
System.Utility.TextFile.initializeClass(String File) in
C:\Development\Visual Studio Projects\System\Utilities\TextFile.cs:190
System.Utility.TextFile..ctor() in C:\Development\Visual Studio
Projects\System\Utilities\TextFile.cs:126
System.Utility.LogFile..ctor(String File) in C:\Development\Visual
Studio Projects\System\Utilities\LogFile.cs:75
System.Utility.TraceDebugListener..ctor(String Type) in
C:\Development\Visual Studio
Projects\System\Utilities\TraceDebugListener.cs:82
System.Utility.ListenerDebug..ctor() in C:\Development\Visual Studio
Projects\System\Utilities\ListenerDebug.cs:10
eRMS.Global.Session_Start(Object sender, EventArgs e) in
c:\inetpub\wwwroot\eRMSTest_NET\Global.asax.cs:73
System.Web.SessionState.SessionStateModule.RaiseOn Start(EventArgs e)
System.Web.SessionState.SessionStateModule.OnStart (EventArgs e)
System.Web.SessionState.SessionStateModule.Complet eAcquireState()
System.Web.SessionState.SessionStateModule.BeginAc quireState(Object
source, EventArgs e, AsyncCallback cb, Object extraData)

System.Web.AsyncEventExecutionStep.System.Web.Http Application+IExecutionStep.Execute()
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously) +173
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573;
ASP.NET Version:1.1.4322.573
Again, thanks for all of your help.

Jerry Pisk wrote:
You need to disable Simple file sharing under Folder Options to be able
to set permissions in WinXP.

If the ASPNET's temp directory is set to a valid path then I don't know
what might be causing the problem.

Jerry

"Glenn A. Harlan" <ga******@hotmail.com> wrote in message
news:IJ********************@comcast.com...
The system environment Temp and Tmp are both set to "C:\WINDOWS\TEMP".
I'm running XP Professional. My user has Temp and Tmp set to:
%USERPROFILE%\Local Settings\Temp.
The Path.GetTempPath is showing the ASPNET user Local Temp.
In windows XP there doesn't seem to any place to specificaly set folder
permissions as in 2000 or 2003 Server for an individual user.

Jerry Pisk wrote:

Most likely it would be the ASPNET user. I'm not sure how to set that
user's environment (without writing code) but first check what the temp
directory is, Path.GetTempPath(). Check if the name is valid and the
directory exists and that ASPNET can write into it (but i think you'd
get a different exception if it was a permission issue).

Jerry

"Glenn A. Harlan" <ga******@hotmail.com> wrote in message
news:ZP********************@comcast.com...
>Wouldn't that be the ASPNET user?
>If so how do I set the environment for that User?
>
>
>Jerry Pisk wrote:
>
>
>>Because your TEMP or TMP environment variable (for your web site's
>>account) is an invalid directory name?
>>
>>Jerry
>>
>>"Glenn A. Harlan" <ga******@hotmail.com> wrote in message
>>news:Hp********************@comcast.com...
>>
>>
>>
>>>Why am I receiving the below error when calling -
>>>Path.GetTempFileName()
>>>
>>>
>>>The directory name is invalid.
>>>Description: An unhandled exception occurred during the execution of
>>>the current web request. Please review the stack trace for more
>>>information about the error and where it originated in the code.
>>>
>>>Exception Details: System.IO.IOException: The directory name is
>>>invalid.
>>>
>>
>>
>>


Jul 21 '05 #8

P: n/a
ATCS is this computers name, I didn't move any user profiles. The other
users profiles on this machine are just under Document and Settings,
ASPNET is the only one under ATCS. GetTempPath returns the correct
path, I mean C:\Documents and Settngs\ATCS..., so why would
GetTempFileName return an error... It doesn't make any sense. Do you
know how to change the Temp path for a specific user running XP?
Jerry Pisk wrote:
Unless you changed the default directory structure there's one directory too
much in that path. I don't think that \ATCS\ should be there, that is unless
you moved your profiles from C:\Documents and Settings\ to C:\Documents and
Settings\ATCS\. If you didn't there's your problem.

Jerry

"Glenn A. Harlan" <ga******@hotmail.com> wrote in message
news:JM********************@comcast.com...
First off, thanks for all of your advice.

I changed the folder settings, and ASPNET is authorized to write to that
directory.
Path.GetTempPath() returns: C:\DOCUME~1\ATCS\ASPNET\LOCALS~1\Temp\
But, Path.GetTempFileName() still returns an Error, I pasted the info
below.

The directory name is invalid.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.IO.IOException: The directory name is invalid.

Source Error:

Line 1847: // Get a temporary system filename
Line 1848: lFile = Path.GetTempPath();
Line 1849: lFile = Path.GetTempFileName();
Line 1850: File.Delete(lFile);
Line 1851: lPath = Path.GetPathRoot(lFile);
Source File: c:\development\visual studio
projects\system\utilities\utilities.cs Line: 1849

Stack Trace:

[IOException: The directory name is invalid.]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +723
System.IO.Path.GetTempFileName() +90
System.Utility.Utilities.GetFilename(String Prefix, String Extention,
Boolean AddDateStamp, Boolean AddTimeStamp) in c:\development\visual
studio projects\system\utilities\utilities.cs:1849
System.Utility.Utilities.GetFilename() in c:\development\visual studio
projects\system\utilities\utilities.cs:1799
System.Utility.TextFile.initializeClass(String File) in
C:\Development\Visual Studio Projects\System\Utilities\TextFile.cs:190
System.Utility.TextFile..ctor() in C:\Development\Visual Studio
Projects\System\Utilities\TextFile.cs:126
System.Utility.LogFile..ctor(String File) in C:\Development\Visual
Studio Projects\System\Utilities\LogFile.cs:75
System.Utility.TraceDebugListener..ctor(String Type) in
C:\Development\Visual Studio
Projects\System\Utilities\TraceDebugListener.cs: 82
System.Utility.ListenerDebug..ctor() in C:\Development\Visual Studio
Projects\System\Utilities\ListenerDebug.cs:10
eRMS.Global.Session_Start(Object sender, EventArgs e) in
c:\inetpub\wwwroot\eRMSTest_NET\Global.asax.cs:7 3
System.Web.SessionState.SessionStateModule.RaiseOn Start(EventArgs e)
System.Web.SessionState.SessionStateModule.OnStart (EventArgs e)
System.Web.SessionState.SessionStateModule.Complet eAcquireState()
System.Web.SessionState.SessionStateModule.BeginAc quireState(Object
source, EventArgs e, AsyncCallback cb, Object extraData)

System.Web.AsyncEventExecutionStep.System.Web.Ht tpApplication+IExecutionStep.Execute()
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously) +173
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573;
ASP.NET Version:1.1.4322.573
Again, thanks for all of your help.

Jerry Pisk wrote:
You need to disable Simple file sharing under Folder Options to be able
to set permissions in WinXP.

If the ASPNET's temp directory is set to a valid path then I don't know
what might be causing the problem.

Jerry

"Glenn A. Harlan" <ga******@hotmail.com> wrote in message
news:IJ********************@comcast.com...
The system environment Temp and Tmp are both set to "C:\WINDOWS\TEMP".
I'm running XP Professional. My user has Temp and Tmp set to:
%USERPROFILE%\Local Settings\Temp.
The Path.GetTempPath is showing the ASPNET user Local Temp.
In windows XP there doesn't seem to any place to specificaly set folder
permissions as in 2000 or 2003 Server for an individual user.

Jerry Pisk wrote:
>Most likely it would be the ASPNET user. I'm not sure how to set that
>user's environment (without writing code) but first check what the temp
>directory is, Path.GetTempPath(). Check if the name is valid and the
>directory exists and that ASPNET can write into it (but i think you'd
>get a different exception if it was a permission issue).
>
>Jerry
>
>"Glenn A. Harlan" <ga******@hotmail.com> wrote in message
>news:ZP********************@comcast.com...
>
>
>
>>Wouldn't that be the ASPNET user?
>>If so how do I set the environment for that User?
>>
>>
>>Jerry Pisk wrote:
>>
>>
>>
>>>Because your TEMP or TMP environment variable (for your web site's
>>>account) is an invalid directory name?
>>>
>>>Jerry
>>>
>>>"Glenn A. Harlan" <ga******@hotmail.com> wrote in message
>>>news:Hp********************@comcast.com.. .
>>>
>>>
>>>
>>>
>>>>Why am I receiving the below error when calling -
>>>>Path.GetTempFileName()
>>>>
>>>>
>>>>The directory name is invalid.
>>>>Description: An unhandled exception occurred during the execution of
>>>>the current web request. Please review the stack trace for more
>>>>information about the error and where it originated in the code.
>>>>
>>>>Exception Details: System.IO.IOException: The directory name is
>>>>invalid.
>>>>
>>>
>>>
>>>



Jul 21 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.