title: unable to upload file on server "Error 500 Inter server Error"
body: <p>I am stuck in upload file it works fine on local but when I deploy on server it show </p>
  
  <blockquote>
    <p>500 internal server Error..</p>
  </blockquote>
  
  <p>Here its my code please review..where m wrong? </p>
  
  <p>Here's my controller code</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>[HttpPost]
  public ActionResult GlovalValues(Global_values REC, HttpPostedFileBase uploadFile)
  {
      string strPath = "~/Laptop_File/";
      string Server_path = "";
      string GetFileName = "";
  
      int id = REC.ID;
      string Desc = REC.GS_Desc;
      string Name = REC.GS_Name;
      string values = REC.GS_Values;
      int Effrows = 0;
  
      if (uploadFile != null &amp;&amp; uploadFile.ContentLength &gt; 0)
      {
          try
          {
              if (!Directory.Exists(Server.MapPath(strPath)))
              {
                  DirectoryInfo di = Directory.CreateDirectory(Server.MapPath(strPath));
              }
              if (Request.Files.Count &gt; 0)
              {
                  var file = Request.Files[0];
                  var filePath = Request.FilePath;
  
                  var FileExtension = uploadFile.FileName.Substring(uploadFile.FileName.LastIndexOf('.') + 1).ToLower();
  
                  string ActualFileName = uploadFile.FileName;
  
                  GetFileName = Path.GetFileNameWithoutExtension(uploadFile.FileName);
  
  
                  if (file != null &amp;&amp; file.ContentLength &gt; 0)
                  {
                      string UploadFileName = Path.GetFileName(GetFileName + "." + FileExtension);
                      Server_path = Path.Combine(Server.MapPath("~/Laptop_File/"), UploadFileName);
  
                      if (FileExtension == "xlsx" || FileExtension == "xltx" || FileExtension == "xls" ||      FileExtension == "xlt ")
                      {
                          file.SaveAs(Server_path);
                      }
                  }
              }           
          }
          catch (Exception ex)
          {
              throw;
          }
      }
      return RedirectToAction("Global_Values_List", "GS_Global_Values");
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>here's my view</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>@using (Html.BeginForm("GlovalValues", "GS_Global_Values", FormMethod.Post, new { @id = "id", @enctype = "multipart/form-data" }))
  {
      &lt;div class="form-group"&gt;
          &lt;label&gt; Uplaod File : &lt;/label&gt;
          &lt;div class="col-md-10"&gt;
              &lt;input type="file" name="uploadFile"  id="fileupload" /&gt;
          &lt;/div&gt;
       &lt;/div&gt;
  
       &lt;div class="form-group"&gt;
           &lt;div class="col-md-offset-2 col-md-10"&gt;
               &lt;input type="submit" value="Create" class="btn btn-default" /&gt;
            &lt;/div&gt;
       &lt;/div&gt;
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Please help I cant figure out whats wrong</p>