Re: Error calling Path.GetTempFileName(): The directory name is invalid by Glenn
Glenn
Tue Jun 15 20:35:41 CDT 2004
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" <gaharlan@hotmail.com> wrote in message
> news:JMednUoas_A6yFPdRVn-vg@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.RaiseOnStart(EventArgs e)
>> System.Web.SessionState.SessionStateModule.OnStart(EventArgs e)
>> System.Web.SessionState.SessionStateModule.CompleteAcquireState()
>> System.Web.SessionState.SessionStateModule.BeginAcquireState(Object
>>source, EventArgs e, AsyncCallback cb, Object extraData)
>>
>>System.Web.AsyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
>> System.Web.HttpApplication.ExecuteStep(IExecutionStep 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" <gaharlan@hotmail.com> wrote in message
>>>news:IJ-dnbQXH8w-Y1HdRVn-sQ@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" <gaharlan@hotmail.com> wrote in message
>>>>>news:ZPqdnRU8kdN_K1bdRVn-ug@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" <gaharlan@hotmail.com> wrote in message
>>>>>>>news:HpednTP-kOD1yVfd4p2dnA@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.
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>
>
>