title: Back button causes naked partial view
body: <p>Here's the scenario: I invoke an action method which returns PartialViewresult via ajax. The result is loaded into another view. Then I Navigate to another page and after this if I press browser back button the previously loaded PartialViewResult appears naked. By naked I mean no container view and layout is loaded, just plain html elements are rendered. Like this:</p>
  
  <p><a href="https://i.stack.imgur.com/XwqDZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XwqDZ.png" alt="enter image description here"></a></p>
  
  <p>Has anyone faced and tackled this problem?</p>
  
  <p>EDIT: To provide a better understanding of the situation here's my action method:</p>
  
  <pre><code>public ActionResult Inbox(int pageNumber = 1, int pageSize = 10, string filter = null)
  {
      var inboxItems = GetInboxItems(filter);
      PagedList&lt;InboxItem&gt; pagedList = inboxItems.ToPagedList(pageNumber, pageSize);
      pagedList.DisplayPage(pageNumber);
      InboxViewModel vm = new InboxViewModel(pagedList);
      if (!Request.IsAjaxRequest())
          return View(vm);
      return PartialView(vm);
  }
  </code></pre>
  
  <p>In the Inbox.cshtml file I load layout based on if the request is ajax request:</p>
  
  <pre><code>@model Dokcentra.Models.InboxViewModel
  
  @if (!Request.IsAjaxRequest())
  {
      Layout = "~/Views/Shared/_Cabinet.cshtml";
  }
  </code></pre>
  
  <p>I think the last piece of code is what causes this problem because the layout file _Cabinet.cshtml has all the html, css and js and when I press browser back button that layout file doesn't load.</p>