Temporary raster - what if TEMP/TMP is readonly?

Discussion created by kdolson on Jun 20, 2011
Latest reply on Sep 12, 2012 by kdolson
I'm developing a tool in VB.Net that involves some raster processing using temporary datasets for the intermediate steps.  Typically, ArcMap does this by storing the temporary rasters in the folder specified by the system TEMP or TMP variables.  These temporary rasters go away automatically when they are no longer referenced or when I release the objects in code.  Everything works perfectly fine according to ArcObjects documentation.  That is, unless the value of TEMP/TMP points to a folder that is not writeable by the user. 

For example, I have a user with TEMP/TMP set to "C:\Program Files\ArcGIS\Bin" (which I'd advise against, but that's a different story).  When the user runs my tool, ArcMap cannot save the temp rasters to that location and the tool crashes.

Is there a better way to handle temporary rasters?  I've seen some sample code that uses a hardcoded "C:\temp" location, but I don't think that's the best practice either.

thanks for your help,