title: Mvc 4 - How to pass parameters to a partial view with viewbag
body: <p>I have a _Layout page and in this _Layout page, I am calling a Partial View as below. </p>
  
  <pre><code>&lt;div&gt;
      @{Html.RenderAction("_Account", "Home");}
  &lt;/div&gt;
  </code></pre>
  
  <p>_Account.cshtml </p>
  
  <p>...</p>
  
  <pre><code>    @if (User.Identity.IsAuthenticated)
              {
                  &lt;p class="navbar-text navbar-right"&gt; ****I want to write here "UserName"****&lt;/p&gt;           }
  </code></pre>
  
  <p>As you see, I want to write userName if the user is authenticated. ( this is my question :) )</p>
  
  <p>As you can expect, I have an Login controller..</p>
  
  <pre><code>    [HttpPost]
      public ActionResult Index(UserModel model, string returnUrl)
      {
          // My codes for login ...
          var response = _userService.UserGet(request.UserName,request.Password);
  
          if(response != null)
           {
              ViewBag.UserName = response.User.Name;
           }
        // My another codes....
      }
  </code></pre>
  
  <p>So, here is my question. I want to use this "ViewBag.UserName" in _Account partial view. I don t wanna use cookies.  Is there any way to to id?</p>