You can store it in the ViewBag
in a base controller:
public class BaseController : Controller {
protected override void OnActionExecuting(ActionExecutingContext filterContext) {
ViewBag.UserName =
filterContext.HttpContext.User.Identity.IsAuthenticated
? filterContext.HttpContext.User.Identity.Name
: "GUEST";
base.OnActionExecuting(filterContext);
}
}
Have all of your controllers inherit from the base controller.. then your views can become:
<p>Hello @ViewBag.UserName</p>