title: Handle UnauthorizedAccessException When Directory.CreateDirectory() Run
body: <p>I have a method that is helps to Create a Directory ifNotExist and Save the path of the File ,...
  Now I have a little problem, There is an Exception casted when <code>Directory.CreateDirectory(savePath);</code> Runs. and I can't still get it right. I would like to know what I am doing wrong and how to fix it. Anyone Subjections is welcome. Thanks </p>
  
  <p>Here is My Method:</p>
  
  <pre><code>protected void ASPxUpload_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
      {
          if (e.IsValid)
          {
              String savepath = String.Format("{0}{1}\\", MapPath(@"~\TicketUploads\"), Session["lastcallid"]);
              if (!Directory.Exists(savepath))
              {
                  Directory.CreateDirectory(savepath);
              }
              String savefile = String.Format("{0}{1}", savepath, e.UploadedFile.FileName);
              e.UploadedFile.SaveAs(savefile);
              String urlPath = String.Format("{0}{1}\\{2}", @"~\TicketUploads\", Session["lastcallid"], e.UploadedFile.FileName);
              fault_detail fltdet = session.GetObjectByKey&lt;fault_detail&gt;(Convert.ToInt32(Session["lastcallid"]));
              fltdet.hasattachment = "Y";
              fltdet.AttachUrl = urlPath;
              fltdet.Save();
          }
      }
  </code></pre>
  
  <p>For more details of What I trying to do: 
   It simple allows the web server to identify the ID of the log user. and With that ID, We should therefore create a folder in <strong>Ticketuploads</strong> Folder. Which is like we are trying to create 2 folders at the same time. That is why I use: <code>"{0}{1}\\"</code></p>