Could not write to output file ... The directory name is invalid

Recently had a problem deploying an app to a fresh 2003 server. Basically, the application wouldn't start, instead we recieved an error stating that the compiler couldn't write to the "Temporary ASP.NET Files" folder because the path was invalid.

Eventually I tracked down the resolution :;en-us;825791


The system TEMP and TMP variables point to a folder that does not exist. The compiler generates temporary files in the folder where the TEMP and the TMP variables point to before the files are copied to the Temporary ASP.NET Files folder. However, the folder where the system variables point to is deleted when you restart the computer. Therefore, the compiler cannot generate the temporary files.


  • Create a temporary folder under , and then name it Temp.
  • Grant full permissions on the Temp folder to the NETWORK SERVICE user account.
  • Right-click My Computer, and then click Properties.
  • On the Advanced tab, click Environment Variables.
  • Select the TEMP variable under System variables, and then click Edit.
  • Type \TEMP in the Variable Value box, and then click OK.
  • Repeat last two steps to edit the TMP variable. Click OK two times.
  • Click Start, and then click Run.
  • To reset Internet Information Services (IIS), type iisreset on the command prompt.

Note If the error message that is mentioned in the "Symptoms" section of this article persists, restart the computer.

Author Paul Hayman

Paul is the COO of kwiboo ltd and has more than 20 years IT consultancy experience. He has consulted for a number of blue chip companies and has been exposed to the folowing sectors: Utilities, Telecommunications, Insurance, Media, Investment Banking, Leisure, Legal, CRM, Pharmaceuticals, Interactive Gaming, Mobile Communications, Online Services.

Paul is the COO and co-founder of kwiboo ( and is also the creator of GeekZilla.

Add Comment


Your comment has been received and will be shown once it passes moderation.