What does SetEnvironmentVariable do
<p>On a web site I took over from someone else - this line appears before loading a crystal report into a report viewer</p>

<pre><code>System.Environment.SetEnvironmentVariable("TMP", @"C:\Temp");
</code></pre>

<p>It does not get mentioned again - apart from in an error message further down the page which seems to simply report that 'TMP' equals C:\Temp</p>

<p>What does that line actually do?</p>

<p>Here is the full code:</p>

<pre><code>ReportDocument ViewReport = new ReportDocument();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Page_Init(object sender, EventArgs e)
{
    try
    {
        string ReportPath = Server.UrlDecode(Request["Path"]);
        System.Environment.SetEnvironmentVariable("TMP", @"C:\Temp");
        ViewReport.Load(@ReportPath);
        ViewReport.SetDatabaseLogon(ConfigurationManager.AppSettings["ReportsUser"], ConfigurationManager.AppSettings["ReportsPassword"]);
        CrystalReportViewer1.Height = 640;
        CrystalReportViewer1.Width = 1100;
        CrystalReportViewer1.BestFitPage = false;
        CrystalReportViewer1.PrintMode = CrystalDecisions.Web.PrintMode.ActiveX;
        CrystalReportViewer1.ReportSource = ViewReport;
        CrystalReportViewer1.RefreshReport();
    }
    catch (Exception err)
    {
        string Err = "Error :-" + err.Message;
        Err = Err + "Source :-" + err.Source;
        Err = Err + "Inner Error :-" + err.InnerException.Message.Replace("\r", "");
        Err = Err + "Path not found :-" + Server.UrlDecode(Request["Path"]);
        Err = Err + " TMP=" + System.Environment.GetEnvironmentVariable("TMP");
        string Message = "&lt;script&gt; alert(' " + Err + "');&lt;/script&gt;";
        Response.Write(Message);
    }
}
</code></pre>
