I use twitter bootstrap package in my application for my application layout. I mainly use _BootstrapLayout.basic.cshtml as the default layout.
@using System.Web.Optimization @using BootstrapSupport @using NavigationRoutes <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>@ViewBag.Title</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="@Styles.Url("~/content/css")" rel="stylesheet"/> @RenderSection("head", required: false) @RenderSection("jtable", required:false) @Html.Partial("_html5shiv") @* favicons and touch icons go here *@ </head> <body> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a> <a class="brand" href="#" title="change in _bootstrapLayout.basic.cshtml">Sorama</a> <div class="nav-collapse collapse"> <ul class="nav"> @Html.Navigation() </ul> </div> </div> </div> </div> <div class="container"> @Html.Partial("_alerts") @Html.Partial("_validationSummary") @RenderBody() <hr> <footer> <p>© Sorama @System.DateTime.Now.ToString("yyyy")</p> </footer> </div> @Scripts.Render("~/js") @RenderSection("Scripts", required: false) </body> </html>
this gives me a navigation bar page 
How can I show a welcome message to a registered user in the right corner of the navigation bar? Something like Welcome ABC! and some side logout options? The only thing I know is to get the name of the current user from User.Identity.Name , but I do not know how to do this in the menu bar. I could not find something that could help me, so I thought that I could get it here.
Edit : after adding @User.Identity.Name I added the above code after the <ul> tag using @html.navigation and this is what I get 
I get a welcome demo in the menu bar (next to a profile that is hard to see), but I didnβt expect anything like that. Can something do in the DefaultRouteConfig provided by Bootstrap?
public class LayoutsRouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.MapNavigationRoute<ModuleController>("Module", c => c.Index()); routes.MapNavigationRoute<AccountController>("Hardware", c => c.Login()); routes.MapNavigationRoute<LayoutsController>("Profile", c => c.Starter()) .AddChildRoute<LayoutsController>("Change Password", c => c.Marketing()) .AddChildRoute<AccountController>("Add User", c => c.Register()) .AddChildRoute<LayoutsController>("Logout", c => c.SignIn()) ; } }
source share