title: Add HTML content to a view Dynamically in MVC (without AJAX)
body: <p>I have many static HTML files (Lets say 1.html to 100.html). Is there any way that I can create a link like Files/get/1 (where "Files" is the controller and "get" is the action). Read the file based on the passed id and put the file's content inside my site layout and send it to user.  </p>
  
  <p>In this way the format of those Html file will be preserved, and I wouldn't need to create a View for each file. </p>
  
  <p>I am new to MVC and will appreciate any suggestion/hint. Let me know if the question is not clear.</p>
  
  <p>Thanks for the help in advance.
  Reza,</p>
  
  <p>Edit: Added what I ended up doing.</p>
  
  <p><strong>Answer:</strong> So I used what Darin said below, combined it with a little bit of jQuery and got exactly what I needed. Which was loading static HTML files inside my layout. Here is the sample of what I did:</p>
  
  <p>First I created two methods in my Controller:</p>
  
  <pre><code>    public ActionResult GetHelp(String id)
      {
          var folder = Server.MapPath(Config.get().Help_Folder);
          var file = Path.Combine(folder, id + ".html");
          if (!System.IO.File.Exists(file))
          {
              return HttpNotFound();
          }
          return Content(System.IO.File.ReadAllText(file), "text/html");
  
      }
  
  
      public ActionResult GetHelper(String id)
      {
  
          ViewBag.helpPath = id; 
          return View();
  
      }
  </code></pre>
  
  <p>Then I created a view called GetHelper, which uses my layout, and added the below code to it:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  $(function () {
      var path = "@ViewBag.helpPath"
      path = "@Url.Content("~/Helps/GetHelp/")" + path;
      $('#help-content').load(path);
  
  });
  &lt;/script&gt;
  
  &lt;div id="help-content"&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>And it works perfectly. The only downside is for each page we get two server requests :(</p>