title: Upload File Website Hosted In IIS Returns HTTP 404 File Or Directory Not Found
body: <p>my site is hosted at IIS7.5
  i have a controller action as below</p>
  
  <pre><code>[HttpPost]
      public ActionResult Create(ClientDocument clientdocument,HttpPostedFileBase FilePath)
      {
          if (ModelState.IsValid)
          {
              try
              {
                  if (FilePath != null &amp;&amp; FilePath.ContentLength &gt; 0)
                  {
                      var filename = Path.GetFileName(FilePath.FileName);
                      string ext = filename.Split(char.Parse(".")).LastOrDefault();
                      clientdocument.FilePath = clientdocument.Title + "." + ext;
                      var path = Path.Combine(Server.MapPath("~/Uploads"), clientdocument.Title + "." + ext);
                      FilePath.SaveAs(path);
                      db.ClientDocuments.Add(clientdocument);
                      db.SaveChanges();
                      return RedirectToAction("../");
                  }                    
              }
              catch(Exception ex)
              {
                  return HttpNotFound("There Was A Problem Uploading File And Creating A Record");
              }
          }
  
          ViewBag.ClientID = new SelectList(db.Clients, "ClientID", "FullName", clientdocument.ClientID);
          return View(clientdocument);
      }
  </code></pre>
  
  <p>when i click the button it tries to upload the file but then show following error message</p>
  
  <p>http 404 file or directory not found 
  the resource you are looking for might have been removed,had its name changed or is temp unavailable</p>
  
  <p>please assist how to configure iis7.5 to upload this file while in VS2010 every thing is working fine.</p>
  
  <p>EDIT</p>
  
  <p>After Changes @keshav Mentioned 
  View:</p>
  
  <pre><code>    @using (Html.BeginForm("Create", "ClientDocument", FormMethod.Post, new { enctype = "multipart/form-data" }))
  {
      @Html.ValidationSummary(true)
      &lt;fieldset&gt;
              &lt;legend&gt;Attach New Client Document&lt;/legend&gt;
      &lt;div class="editor-label"&gt;
                  @Html.LabelFor(model =&gt; model.FilePath)
              &lt;/div&gt;
              &lt;div class="editor-field"&gt;
                  &lt;input type="file" id="FilePath" name="FilePath" /&gt;
                  @Html.ValidationMessageFor(model =&gt; model.FilePath)
              &lt;/div&gt;
     &lt;fieldset&gt;
  }
  </code></pre>
  
  <p>and Controller:</p>
  
  <pre><code>[HttpPost,ActionName("Create")]
      public ActionResult Create(ClientDocument clientdocument,HttpPostedFileBase FilePath)
      {
          if (ModelState.IsValid)
          {
              try
              {
                  if (FilePath != null &amp;&amp; FilePath.ContentLength &gt; 0)
                  {
                      var filename = Path.GetFileName(FilePath.FileName);
                      string ext = filename.Split(char.Parse(".")).LastOrDefault();
                      clientdocument.FilePath = clientdocument.Title + "." + ext;
                      var path = Path.Combine(Server.MapPath("~/Uploads"), clientdocument.Title + "." + ext);
                      FilePath.SaveAs(path);
                      db.ClientDocuments.Add(clientdocument);
                      db.SaveChanges();
                      return RedirectToAction("Index", "Home");
                  }                    
              }
              catch(Exception ex)
              {
                  return HttpNotFound("There Was A Problem Uploading File And Creating A Record");
              }
          }
  
          ViewBag.ClientID = new SelectList(db.Clients, "ClientID", "FullName", clientdocument.ClientID);
          return View(clientdocument);
      }
  </code></pre>
  
  <p>still i am having same problem as before.</p>