title: Unhandeled exception in application
body: <p>I have been working on a code that will grab the userName from the local machine and place it in a log file and start a .exe if the username has not been recoreded into the log file. I was able to run the code on my local machine, but when I put it on the server and run it I am given an error that reads: </p>
  
  <p>"Unhandeled exception has occurred in your applications" </p>
  
  <p>Details: </p>
  
  <p>See the end of this message for details on invoking 
  just-in-time (JIT) debugging instead of this dialog box.</p>
  
  <p><em><strong></em>**<em>*</em>**<em></strong> Exception Text <strong></em>**<em>*</em>****</strong>
  System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
     at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
     at System.Diagnostics.Process.Start()
     at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
     at System.Diagnostics.Process.Start(String fileName)
     at User.Form1.Form1_Load(Object sender, EventArgs e)
     at System.Windows.Forms.Form.OnLoad(EventArgs e)
     at System.Windows.Forms.Form.OnCreateControl()
     at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
     at System.Windows.Forms.Control.CreateControl()
     at System.Windows.Forms.Control.WmShowWindow(Message&amp; m)
     at System.Windows.Forms.Control.WndProc(Message&amp; m)
     at System.Windows.Forms.ScrollableControl.WndProc(Message&amp; m)
     at System.Windows.Forms.Form.WmShowWindow(Message&amp; m)
     at System.Windows.Forms.Form.WndProc(Message&amp; m)
     at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m)
     at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m)
     at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)</p>
  
  <p>And here is my code////////////////////////////////////</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Windows.Forms;
  using System.IO;
  using System.Diagnostics;
  
  namespace User
  {
      public partial class Form1 : Form
      {
          public const string dir = @"C:\Numara";
          public const string path = dir + @"\Audit.log";
          public const string TrackIT = @"\\tkahd-nti-1\TrackIt\Audit32.exe /Q";
  
          public Form1()
          {
              InitializeComponent();
          }
  
          private void Form1_Load(object sender, EventArgs e)
          {
              //returns user name
              //label1.Text = System.Environment.UserName.ToString();
              string userName = System.Environment.UserName;  //user name
  
              if (!Directory.Exists(dir))
                  //directory does not exist
                  //create it
                  Directory.CreateDirectory(dir);  //creates directory
  
  
              //by this point directory is created
  
              //now check file
              if (!File.Exists(path))
                  //file does not exist, so create it
                  File.Create(path);
  
              //Read data from the .dat file
              string line = System.IO.File.ReadAllText(path);
  
              //if the name of the logged in user
              //is the same as the user name of the text file
              //then exit program
              if (line == userName)
                  Application.Exit();
  
              else
              //clear fields and write new name to file and begin audit
              {
                  //clears fields
                  using (FileStream stream = new FileStream(@"C:\Numara\Audit.log", FileMode.Create))
                  {
                      using (TextWriter writer = new StreamWriter(stream))
                      {
                          //writer.Write("");
                          writer.Write(userName);
                      }
                      // writes new name to file
                  }
  
                  //StreamReader textIn =
                  //  new StreamReader(
                  //    new FileStream(path, FileMode.OpenOrCreate, FileAccess.Read));
  
  
                  //begins audit
  
                  Process.Start(TrackIT);
                  Application.Exit();
              }        
          }
      }
   }
  </code></pre>