GleamTech component temporary folder locations and issues


GleamTechConfiguration.TemporaryFolder property:

Gets or sets a value that specifies the temporary folder used as default by GleamTech components. The default value is [System Temporary Folder]\GleamTech. Value can be a virtual or physical path.  
[System Temporary Folder] can be different for different environments:

  • - For "ASP.NET Classic":
    -- %WINDIR%\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\APPNAME\xxxxxxxx
    -- %WINDIR%\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\APPNAME\xxxxxxxx (if 32-bit AppPool)
    -- %LOCALAPPDATA%\Temp\Temporary ASP.NET Files\vs\xxxxxxxx (when debugging in Visual Studio)

  • - For "ASP.NET Core" the path set in "ASPNETCORE_TEMP" environment variable or result of Path.GetTempPath which depends on "TMP", "TEMP" and "USERPROFILE" environment variables:
    -- %WINDIR%\Temp
    -- %LOCALAPPDATA%\Temp (if "Load User Profile" is enabled for AppPool in IIS)

  • - For Azure WebApp Service:
    -- D:\home (%HOME% environment variable)

  • - For Console or other non-web apps, result of Path.GetTempPath which depends on "TMP", "TEMP" and "USERPROFILE" environment variables:
    -- %LOCALAPPDATA%\Temp
    -- %WINDIR%\Temp

Note that there is also DocumentUltimateWebConfiguration.CacheLocation property which controls only the cache location for DocumentViewer. GleamTechConfiguration.TemporaryFolder property is for all temporary files created globally by GleamTech libraries.


Temporary folder permissions:

Some GleamTech components may extract helper native DLLs to the system temporary folder, so you should make sure you allow Read/Write and Execute permissions for this folder.
The native DLL loading may fail; if extract fails due to missing Read/Write permission or if execution fails due to missing Execute permission.
 
You should make sure IIS_IUSRS group has Modify permission (which includes Read/Write and Execute) on the temp folder, e.g. in Command Prompt (Run As Administrator):
icacls %WINDIR%\Temp /grant IIS_IUSRS:M
After the change, the DLL files may still be in use, so you may need to restart your web server, e.g. in Command Prompt (Run As Administrator):
iisreset 


Changing default temporary folder location:

Temporary folder can be changed via GleamTechConfiguration.TemporaryFolder property. You should set it before calling other library methods, i.e. in application startup. Note that few files like extracted native DLLs may be stored in the initial location (system temporary folder) even if you change it, those are required for library loading but should not take much space (the size does not overgrow).

For an ASP.NET Core project

Set in appsettings.json file:

Json
{
  "GleamTech:TemporaryPath": "YOUR_PATH_HERE"
}

Alternatively you can set in code, in Configure method of your Startup.cs after app.UseGleamTech call:

C#
app.UseGleamTech(() => {
    GleamTechConfiguration.Current.TemporaryFolder = "YOUR_PATH_HERE";
});


For an ASP.NET Classic (MVC or WebForms) project

Set in <appSettings> tag of your Web.config:

XML
<appSettings>
  <add key="GleamTech:TemporaryPath" value="YOUR_PATH_HERE" />
</appSettings>

Alternatively you can set in code, in Application_Start method of your Global.asax.cs:

protected void Application_Start(object sender, EventArgs e)
{
    GleamTechConfiguration.Current.TemporaryFolder = "YOUR_PATH_HERE";
}


For other project types

Set in a static (Shared in VB) method, e.g. in Main method for a Console project:

static void Main(string[] args)
{
    GleamTechConfiguration.Current.TemporaryFolder = "YOUR_PATH_HERE";
}