Did you already know the methods Path.GetTempPath() and Path.GetTempFileName() in the System.IO namespace.
The very useful method GetTempFileName() creates a temporary file for you in a location you have write access. You then can write temporary data to this file.
SharePoint generates for each request a random GUID which correlates all log messages in the ULS log which are printed during the current request. The Correlation ID is also printed to error pages. If you want more information about an error page you can use the Correlation ID to find the right log messages in the ULS log.
Recently I wanted to get the current request’s Correlation ID to share it with an external webservice to have the same correlation ID in all depending systems.
You can add following code to your ASP page to get the Correlation ID.