title: EPiServer MVC currentPage issues
body: <p>I'm currently having some problems with the following codesnippets which seems almost identical to me, but behaves differently.</p>
  
  <p>These snippets are from two different projects I've been working on, and they are built the same way but only one of them works correctly.</p>
  
  <p>These are the Forms where I enter the controllers:</p>
  
  <p>Form 1, inside a twitter bootstrap dropdown menu, located in the _Layout file:</p>
  
  <pre><code>    @using (Html.BeginForm("EditProfile", "ProfilePage", FormMethod.Post))
      {
      &lt;li&gt;
          &lt;button type="submit" class="dropdownButton"&gt;Redigera Profil&lt;/button&gt;
      &lt;/li&gt;
      }
  </code></pre>
  
  <p>Form 2, tried different locations but right now it's in a table in a Block view:</p>
  
  <pre><code>    &lt;td&gt;
          @using (Html.BeginForm("EditProfile", "ProfilePage", FormMethod.Post))
          {
              &lt;button type="submit"&gt;Redigera profil&lt;/button&gt;
          }
      &lt;/td&gt;
  </code></pre>
  
  <p>Both seems pretty identical, right?</p>
  
  <p>Now here are the controllers</p>
  
  <p>Controller 1:</p>
  
  <pre><code>    public ActionResult EditProfile(ProfilePage currentPage)
      {
          var model = new ProfilePageViewModel(currentPage);
          model.CurrentUser = ConnectionHelper.GetUserInformationByEmail(User.Identity.Name);
          return View("EditProfile", model);
      }
  </code></pre>
  
  <p>Controller 2:</p>
  
  <pre><code>    public ActionResult EditProfile(ProfilePage currentPage)
      {
          ProfilePageViewModel model = new ProfilePageViewModel(currentPage);
          model.currentUser = ConnectionHelper.GetCurrentUserByEmail(User.Identity.Name);
          return View("EditProfile", model);
      }
  </code></pre>
  
  <p>Also pretty much identical.</p>
  
  <p>I've added the same routing in both projects:</p>
  
  <pre><code>    protected override void RegisterRoutes(RouteCollection routes)
      {
          base.RegisterRoutes(routes);
          routes.MapRoute(
            "Default",                                             
            "{controller}/{action}/{id}",                           
            new { controller = "Home", action = "Index", id = "" });
      }
  </code></pre>
  
  <p>Now here's the problem:</p>
  
  <p>Form 1 and controller 1 works perfectly and recieves the ProfilePage currentPage without any problems, but form 2 and controller 2 doesn't work and gets null value.
  As I stated earlier Form 1 is posted on the _Layout page and Form 2 is posted from a Block which is rendered within an mvc @section. I don't think this is the problem because I've tried to access the controller from different parts of the page, but it's not working anywhere - but in the other project it's working everywhere, which is driving me insane.</p>
  
  <p>Does anyone have any idea why it is like this? I've stepped through both of them while debugging but the only difference is that one works and the other doesn't.</p>
  
  <p>Thanks in advance</p>
  
  <p>deSex</p>
  
  <p><strong>EDIT :</strong></p>
  
  <p>Here I render a section called "content", where almost everything will be rendered.</p>
  
  <pre><code>    &lt;div id="content"&gt;
       @RenderBody()
       @RenderSection("content", false)
      &lt;/div&gt;
  </code></pre>
  
  <p>My startpage has a ContentArea for blocks, rendered within this section:</p>
  
  <pre><code>@model Intranet.Models.ViewModels.StartPageViewModel
  @section content{
     @if (User.Identity.IsAuthenticated)
     {
         &lt;div class="contentArea"&gt;
             @Html.PropertyFor(x =&gt; x.MainContentArea)
         &lt;/div&gt;
     }
  }
  </code></pre>
  
  <p>And here is the controller that inherits from BlockController:</p>
  
  <pre><code>public class ProfileBlockController : BlockController&lt;ProfileBlock&gt;
  {
      public override ActionResult Index(ProfileBlock currentBlock)
      {
          ProfileBlockViewModel model;
          if (currentBlock != null)
          {
              model = new ProfileBlockViewModel(currentBlock);
          }
          else
          {
              model = (ProfileBlockViewModel)Session["model"];
          }
          model.CurrentUser = ConnectionHelper.GetCurrentUserByEmail(User.Identity.Name);
          var availableStatuses = ConnectionHelper.GetAllOfficeStatuses();
          availableStatuses.Remove(model.CurrentUser.OfficeStatus);
          model.AvailableStatusChanges = availableStatuses;
          Session["model"] = model;
  
          return PartialView(model);
      }
  
  }
  </code></pre>